//Copyright 2002-2010, My Great Software, Inc. All rights reserved.
//**Start Encode**
/*@cc_on@*/
var fEmptyString = "";
var fNewLine = "\n";
var IS_EMPTY = 0;
var eFirstChar = 0;
var eFirstItem = 0;
var fNone = "none";
var fHyphenCombo = "-";
var eZeroCount = 0;
var fBlank = " ";
var S_N_F = -1;
var eMinusOne = -1;
var ePos1 = 1;
var fFalse = "0";
var fTrue = "1";
var fFrontSlash = "/";
var fPeriod = ".";
var fDollarSign = "$";
var fZero = "0";
var eQNoWork = 0;
var fBlock = "block";
var emlPhone = 10;
var m_aPPC = new PPC(false);
var f372 = "List/Combo not allocated.";
function PPC(bMobile)
{
this.bMobile = bMobile;
this.bGecko = false;
}
PPC.prototype.Mobile = A_Mobile;
PPC.prototype.IsMobile = A_IsMobile;
PPC.prototype.LetMobile = A_LetMobile;
PPC.prototype.InitRealValue = A_InitRealValue;
PPC.prototype.Href = A_Href;
PPC.prototype.Status = A_Status;
PPC.prototype.KeyDown = A_KeyDown;
PPC.prototype.NumericWID = A_NumericWID;
PPC.prototype.CalFillDate = A_CalFillDate;
PPC.prototype.Toggle = A_Toggle;
PPC.prototype.StripCommas = A_StripCommas;
PPC.prototype.Trim = A_Trim;
PPC.prototype.Concatenate = A_Concatenate;
PPC.prototype.Lb2Lb = A_Lb2Lb;
PPC.prototype.OneItem = A_OneItem;
PPC.prototype.SelectedValue = A_SelectedValue;
PPC.prototype.Selected = A_Selected;
PPC.prototype.FindValue = A_FindValue;
PPC.prototype.FindValueNumber = A_FindValueNumber;
PPC.prototype.Find = A_Find;
PPC.prototype.InitSelected = A_InitSelected;
PPC.prototype.SetSelected = A_SetSelected;
PPC.prototype.IsFirst = A_IsFirst;
PPC.prototype.GetSelected = A_GetSelected;
PPC.prototype.Profile = A_Profile;
PPC.prototype.RealValueIsEmpty = A_RealValueIsEmpty;
PPC.prototype.RealValue = A_RealValue;
PPC.prototype.Click = A_Click;
PPC.prototype.Export = A_Export;
PPC.prototype.Inspect = A_Inspect;
PPC.prototype.ToggleCalendar = A_ToggleCalendar;
PPC.prototype.ClickCalendar = A_ClickCalendar;
PPC.prototype.Stripes = A_Stripes;
PPC.prototype.SetCookie = A_SetCookie;
PPC.prototype.GetCookie = A_GetCookie;
PPC.prototype.IsXpSp2 = A_IsXpSp2;
PPC.prototype.GetDataPath = A_GetDataPath;
PPC.prototype.Customer = A_Customer;
PPC.prototype.InternetZone = V_InternetZone;
PPC.prototype.IsWellFormed = A_IsWellFormed;
PPC.prototype.IsNumeric = A_IsNumeric;
PPC.prototype.NoChanges = A_NoChanges;
PPC.prototype.Show = A_Show;
PPC.prototype.Hide = A_Hide;
PPC.prototype.AddPrompt = A_AddPrompt;
PPC.prototype.EditPrompt = A_EditPrompt;
PPC.prototype.Exists = A_Exists;
PPC.prototype.CookiesEnabled = A_CookiesEnabled;
PPC.prototype.Seq = A_Seq;
PPC.prototype.SortAction = A_SortAction;
PPC.prototype.CompareDates = A_CompareDates;
PPC.prototype.Now = A_Now;
PPC.prototype.AddOption = V_AddOption;
PPC.prototype.ToggleB = A_ToggleB;
PPC.prototype.IsIntranet = V_IsIntranet;
PPC.prototype.InvalidSort = A_InvalidSort;
PPC.prototype.ToggleC = A_ToggleC;
PPC.prototype.DateRange = A_DateRange;
PPC.prototype.SelectedValueNumber = P_SelectedValueNumber;
PPC.prototype.SS_DateRange = A_SS_DateRange;
PPC.prototype.IsHidden = A_IsHidden;
PPC.prototype.IsVisible = A_IsVisible;
PPC.prototype.ProtectedMode = V_ProtectedMode;
PPC.prototype.InvalidAssignment = V_InvalidAssignment;
PPC.prototype.FormatE = A_FormatE;
PPC.prototype.SortSeqA = A_SortSeqA;
PPC.prototype.ValidateTagsA = A_ValidateTagsA;
PPC.prototype.ValidateTags = A_ValidateTags;
PPC.prototype.ExcNumber = A_ExcNumber;
PPC.prototype.Gecko = V_Gecko;
PPC.prototype.AddOptionM = V_AddOptionM;
PPC.prototype.IsGecko = A_IsGecko;
PPC.prototype.LenNote = A_LenNote;
PPC.prototype.ActiveX = A_ActiveX;
PPC.prototype.Inner = A_Inner;
PPC.prototype.InnerG = A_InnerG;
PPC.prototype.InnerOpPlusEq = A_InnerOpPlusEq;
PPC.prototype.DivError = A_DivError;
PPC.prototype.FmtCurr = A_FmtCurr;
PPC.prototype.Popup = A_Popup;
PPC.prototype.ClickB = A_ClickB;
PPC.prototype.IsFirstA = A_IsFirstA;
PPC.prototype.IsEmpty = A_IsEmpty;
PPC.prototype.Duplicates = A_Duplicates;
PPC.prototype.ValidateExtension = A_ValidateExtension;
PPC.prototype.ValDate = A_ValDate;
PPC.prototype.Upload2003se = V_Upload2003se;
PPC.prototype.ErrLoadUpload = A_ErrLoadUpload;
PPC.prototype.ValWid = A_ValWid;
PPC.prototype.ToggleM = A_ToggleM;
PPC.prototype.PopupG = V_PopupG;
PPC.prototype.IsIe8Strict = V_IsIe8Strict;
PPC.prototype.ToggleSql = A_ToggleSql;
PPC.prototype.GEBI = P_GEBI;
function A_ToggleSql()
{
var oDiv = this.GEBI("divSQL");
var oSpan = this.GEBI("spnSQL");
var bOk = this.ToggleM(oDiv, oSpan);
return bOk;
}
function P_GEBI(sID)
{
return document.getElementById(sID);
}
function V_PopupG(oElement, oDiv, lExtra, bUp)
{
var lX = eZeroCount;
var lY = eZeroCount;
lX = 29;
lY = 2;
while (oElement.offsetParent != null)
{
lX += oElement.offsetLeft;
lY += oElement.offsetTop;
oElement = oElement.offsetParent;
}
with (oDiv.style)
{
var lAdjust = 10;
var sLeft = (lX + lAdjust).toString() + "px";
left = sLeft;
if (bUp)
{
var lHeight = 0;
lHeight = parseInt(height, 10);
var lAdjustY = lHeight;
lAdjustY += lExtra;
top = lY - lAdjustY + "px";
}
else
{
top = lY + "px";
}
}
this.Show(oDiv);
return true;
}
function A_ToggleM(oDiv, oSpan)
{
if (oDiv.style.display == fNone)
{
oDiv.style.display = fBlock;
this.Inner(oSpan, "-");
}
else
{
oDiv.style.display = fNone;
this.Inner(oSpan, "+");
}
return true;
}
function A_ValWid(oEdit, sCaption)
{
if (this.ValidateTagsA(oEdit)) return fEmptyString;
var sWorkId = this.Trim(oEdit.value);
if (sWorkId.length == IS_EMPTY)
{
g_Message("Specify a numeric " + sCaption + " number, not an empty string.");
oEdit.focus();
return fEmptyString;
}
if (isNaN(sWorkId))
{
g_Message("Specify a numeric " + sCaption + " number.");
oEdit.focus();
return fEmptyString;
}
var lWorkId = eQNoWork;
lWorkId = parseInt(sWorkId, 10);
if (lWorkId <= eQNoWork)
{
g_Message("Specify a " + sCaption + " number greater than 0.");
oEdit.focus();
return fEmptyString;
}
var eMaxLong = (Math.pow(2, 31) - 1);
if (lWorkId > eMaxLong)
{
g_Message("Number too large. Maximum value is " + eMaxLong + ".");
oEdit.focus();
return fEmptyString;
}
return sWorkId;
}
function A_ErrLoadUpload(exception)
{
if (this.Upload2003se(exception))
{
var f2003SeUpload = "Upload not supported for Windows Mobile 2003 SE PPC.";
this.DivError(f2003SeUpload, false);
}
else
{
g_Message(this.FormatE(exception));
}
}
function V_Upload2003se(exception)
{
var lError = this.ExcNumber(exception);
return (lError == -2146823281);
}
function A_ValDate(sValue)
{
if (sValue.length == IS_EMPTY) return true;
var lMilliseconds = Date.parse(sValue);
if (isNaN(lMilliseconds))
{
g_Message("Date field has invalid characters.\n\n" + sValue);
return false;
}
return true;
}
function A_ValidateExtension(sFilename)
{
sFilename = sFilename.toLowerCase();
var lPos = sFilename.lastIndexOf(fPeriod);
if ((lPos == S_N_F) || (lPos == sFilename.length))
{
g_Message("File name '" + sFilename + "' must have an extension.");
return false;
}
var sExtension = sFilename.substr(lPos + ePos1);
var sToken = fPeriod + sExtension + fPeriod;
var sExtensionsList = ".avi.awd.bmp.csv.dcx.doc.docx.gif.htm.html.ico.jfx.jpeg.jpg.mpeg.mpg.mp3.mp4." +
"mov.pcx.pdf.png.ppt.rtf.shtml.tif.tiff.txt.vsd.wav.wif.wma.wpd.xif.xls.xlsx.xml.xsl.";
lPos = sExtensionsList.indexOf(sToken);
if (lPos == S_N_F)
{
g_Message("The extension (" + sExtension + ") for file name '" + sFilename + "' is not a known valid (safe) extension.");
return false;
}
return true;
}
function A_Duplicates(csa, csa2, sMessage)
{
var n = csa.length;
var bDuplicate = false;
var sList = fEmptyString;
if (n > 1)
{
var j = eZeroCount;
for (var i = eFirstItem; i < n; i++)
{
for (j = eFirstItem; j < n; j++)
{
if (i != j)
{
if ((csa[i] == csa[j]) && (csa2[i] == csa2[j]))
{
bDuplicate = true;
sList += (csa[i] + " - " + csa2[i] + ". ");
}
}
}
}
}
if (bDuplicate)
{
g_Message("Duplicate " + sMessage + " specified.\n" + sList);
}
return bDuplicate;
}
function A_IsEmpty(oEdit, sCaption)
{
if (this.ValidateTagsA(oEdit)) return false;
if (oEdit.value.length == IS_EMPTY)
{
g_Message(sCaption + " is required.");
oEdit.focus();
return true;
}
return false;
}
function A_IsFirstA(oBox, sCaption)
{
if (oBox.selectedIndex == eFirstItem)
{
g_Message(sCaption + " is required.");
oBox.focus();
return true;
}
return false;
}
function A_Popup(oElement, oDiv, lExtra, bUp)
{
if (this.bGecko)
{
return this.PopupG(oElement, oDiv, lExtra, bUp);
}
var lX = eZeroCount;
var lY = eZeroCount;
var bIe8Strict = this.IsIe8Strict();
if (bUp)
{
lX = event.offsetX;
lY = event.offsetY;
}
else
{
if (bIe8Strict)
{
/*jsl:pass*/
}
else
{
lX = 10;
lY = 10;
}
}
while (oElement.offsetParent != null)
{
lX += oElement.offsetLeft;
lY += oElement.offsetTop;
oElement = oElement.offsetParent;
}
with (oDiv)
{
var lAdjust = 10;
style.pixelLeft = lX + lAdjust;
if (bUp)
{
var lAdjustY = style.pixelHeight;
lAdjustY += lExtra;
style.pixelTop = lY - lAdjustY;
}
else
{
if (bIe8Strict)
{
lY += lAdjust;
}
style.pixelTop = lY;
}
}
this.Show(oDiv);
return true;
}
function V_IsIe8Strict()
{
var bReturn = false;
var sUserAgent = navigator.userAgent.toLowerCase();
var bIe8 = (sUserAgent.indexOf("msie 8") > S_N_F);
if (bIe8)
{
if (document.documentMode)
{
var eMode = parseInt(document.documentMode, 10);
if (eMode == 8)
{
bReturn = true;
}
}
}
return bReturn;
}
function A_FmtCurr(oTD, sAmount)
{
this.Inner(oTD, sAmount);
}
function A_DivError(sText, bInit)
{
if (bInit)
{
this.Inner(divError, sText);
}
else
{
this.InnerOpPlusEq(divError, sText);
}
}
function A_InnerOpPlusEq(oObj, sText)
{
if (this.bGecko)
{
oObj.textContent += sText;
}
else
{
oObj.innerText += sText;
}
return true;
}
function A_InnerG(oObj)
{
var sText = fEmptyString;
if (this.bMobile)
{
if (this.bGecko)
{
sText = oObj.innerHTML;
}
else
{
sText = oObj.innerText;
}
}
else
{
sText = oObj.innerText;
}
return sText;
}
function A_Inner(oObj, sText)
{
if (this.bMobile)
{
if (this.bGecko)
{
oObj.innerHTML = sText;
}
else
{
oObj.innerText = sText;
}
}
else
{
oObj.innerText = sText;
}
return true;
}
function A_ActiveX()
{
if (window.ActiveXObject) return true;
g_Message("ActiveXObject not supported or security settings are preventing the use of ActiveX objects.");
return false;
}
function A_LenNote(oTextArea)
{
if (oTextArea.value.length < 10)
{
g_Message("Enter a value of at least 10 characters.");
oTextArea.focus();
return false;
}
return true;
}
function A_IsGecko()
{
return this.bGecko;
}
function V_AddOptionM(oSelect, oFrom, n)
{
var oOption = document.createElement("OPTION");
with (oOption)
{
text = oFrom.text;
value = oFrom.value;
}
var bOk = true;
try
{
if (this.bGecko)
{
oSelect.options.add(oOption, null);
}
else
{
oSelect.options.add(oOption);
}
}
catch (exception)
{
if (this.InvalidAssignment(exception))
{
g_Message("Invalid assignment " + n);
}
else
{
g_Message("Error adding item " + n + " to the list.\n" + this.FormatE(exception));
bOk = false;
}
}
return bOk;
}
function V_Gecko()
{
this.bGecko = (navigator.userAgent.toLowerCase().indexOf("gecko") > 0);
}
function A_ExcNumber(exception)
{
var lError = eMinusOne;
if (this.bGecko)
{
lError = exception.result;
}
else
{
lError = exception.number;
}
return lError;
}
function A_ValidateTagsA(oEdit)
{
if (this.ValidateTags(oEdit.value, false))
{
oEdit.focus();
return true;
}
return false;
}
function A_ValidateTags(sSource, bSilent)
{
if (sSource.length == IS_EMPTY) return false;
re = /[\x80-\xff]/g;
sSource = sSource.replace(re, ".");
re = /((<|%60|&lt;|&#x3c|\\u003c)\s*(applet|body|embed|form|frame|frameset|html|iframe|ilayer|img|layer|meta|object|script|style)\s*(>|%62|&gt;|&#x3e|\\u003e))|((<|%60|&lt;|&#x3c|\\u003c).*(>|%62|&gt;|&#x3e|\\u003e))|(&.{1,5};)|eval\s*\(|(event\s*=)|javascript:|jscript:|vbscript:/;
var aMatches = re.exec(sSource);
var bFound = (aMatches != null);
var lIndex = eMinusOne;
if (bFound)
{
lIndex = aMatches.index + 1;
}
if (bFound && (! bSilent))
{
g_Message("Field contains restricted characters and will not be processed.\n\n" + sSource);
}
return bFound;
}
function A_SortSeqA(lSort, lSeq)
{
var sReturn = (lSort + "&Seq=" + lSeq);
return sReturn;
}
function A_FormatE(exception)
{
var lError = this.ExcNumber(exception);
return (lError + fNewLine + exception.message);
}
function V_InvalidAssignment(exception)
{
var lError = this.ExcNumber(exception);
return (lError == -2147024809);
}
function V_ProtectedMode(exception)
{
var lError = this.ExcNumber(exception);
var errProtectedMode = -2147024831;
return (lError == errProtectedMode);
}
function A_IsHidden(oDiv)
{
var bHidden = false;
if (! this.bMobile)
{
if (oDiv.currentStyle)
{
bHidden = (oDiv.currentStyle.display == fNone);
}
}
if (! bHidden)
{
bHidden = (oDiv.style.display == fNone);
}
return bHidden;
}
function A_IsVisible(oDiv)
{
var bVisible = false;
if (! this.bMobile)
{
if (oDiv.currentStyle)
{
bVisible = (oDiv.currentStyle.display == fBlock);
}
}
if (! bVisible)
{
var fEmptyStyle = "";
switch (oDiv.style.display)
{
case fBlock:
case fEmptyStyle:
bVisible = true;
break;
default: break;
}
}
return bVisible;
}
function A_SS_DateRange(oEdit)
{
var sDate = oEdit.value;
if (sDate.length == IS_EMPTY) return true;
if (! this.ValDate(sDate))
{
return false;
}
var lMilli = eZeroCount;
try
{
lMilli = Date.parse(sDate);
}
catch (exception)
{
g_Message("Invalid date: " + sDate);
return false;
}
var l_Jan_1_1753 = -6847786800000;
var l_12_31_9999 = 253402232400000;
var bOk = (lMilli >= l_Jan_1_1753);
if (bOk)
{
bOk = (lMilli <= l_12_31_9999);
}
if (! bOk)
{
g_Message("The date entered (" + sDate + ") must be between 1/1/1753 and 12/31/9999");
oEdit.focus();
}
return bOk;
}
function P_SelectedValueNumber(oBox)
{
var sNumber = this.SelectedValue(oBox);
var lNumber = eMinusOne;
if (! isNaN(sNumber)) lNumber = parseInt(sNumber, 10);
return lNumber;
}
function A_DateRange(oCombo, oEditStart, oEditEnd)
{
var sValue = this.SelectedValue(oCombo);
if (sValue.length == IS_EMPTY) return false;
var sFrom = fEmptyString;
var sTo = fEmptyString;
if (sValue.length > 1)
{
var lPos = sValue.indexOf(":");
if (lPos > S_N_F)
{
sFrom = sValue.substr(eFirstChar, lPos);
sTo = sValue.substr(lPos + ePos1);
}
}
if (! this.ValDate(sFrom))
{
return false;
}
if (! this.ValDate(sTo))
{
return false;
}
oEditStart.value = sFrom;
oEditEnd.value = sTo;
if (! this.bMobile)
{
oEditStart.realValue = sFrom;
oEditEnd.realValue = sTo;
}
return true;
}
function A_ToggleC(oSpan)
{
try
{
if (oSpan.style.display == fNone)
{
oSpan.style.display = fBlock;
}
else
{
oSpan.style.display = fNone;
}
}
catch (exception)
{
g_Message(this.FormatE(exception));
}
}
function A_InvalidSort(lColumn)
{
g_Message("Invalid sort column: " + lColumn + ".");
}
function V_IsIntranet(sServer)
{
var lPos = sServer.indexOf(fPeriod);
var bIntranet = (lPos == S_N_F);
if (! bIntranet)
{
re = /\./g;
var sIpAddress = sServer.replace(re, fEmptyString);
if (! isNaN(sIpAddress))
{
if (sServer.substr(eFirstChar, 3) == "10.")
bIntranet = true;
else
if (sServer.substr(eFirstChar, 4) == "192.")
bIntranet = true;
}
}
return bIntranet;
}
function A_ToggleB(oDiv, oSpan)
{
if (this.bMobile && (! this.bGecko)) return;
if (this.IsHidden(oDiv))
{
oDiv.style.display = fBlock;
this.Inner(oSpan, "-");
}
else
{
oDiv.style.display = fNone;
this.Inner(oSpan, "+");
}
}
function A_Now()
{
var oDate = new Date();
var sNow = fEmptyString;
sNow = (oDate.getMonth() + 1) + fFrontSlash + oDate.getDate() + fFrontSlash + oDate.getFullYear();
var lMilliseconds = Date.parse(sNow);
return lMilliseconds;
}
function A_CompareDates(oStart, oEnd, sFrom, bVisible)
{
var sStart = this.Trim(oStart.value);
if (sStart.length > IS_EMPTY)
{
if (! this.ValDate(sStart))
{
if (bVisible) oStart.focus();
return false;
}
var nMilliseconds = eZeroCount;
nMilliseconds = Date.parse(sStart);
if (isNaN(nMilliseconds))
{
g_Message("Non numeric " + sFrom + " start date field: " + sStart);
if (bVisible) oStart.focus();
return false;
}
var sEnd = this.Trim(oEnd.value);
if (sEnd.length == IS_EMPTY)
{
g_Message(sFrom + " End date field required if start date field is specified.");
if (bVisible) oEnd.focus();
return false;
}
if (! this.ValDate(sEnd))
{
if (bVisible) oEnd.focus();
return false;
}
var nMillisecondsEnd = eZeroCount;
nMillisecondsEnd = Date.parse(sEnd);
if (isNaN(nMillisecondsEnd))
{
g_Message("Non numeric " + sFrom + " end date field: " + sEnd);
if (bVisible) oEnd.focus();
return false;
}
if (nMillisecondsEnd < nMilliseconds)
{
g_Message(sFrom + " End date must be later than the Start Date: " + sStart + " - End Date: " + sEnd);
if (bVisible) oEnd.focus();
return false;
}
}
return true;
}
function A_SortAction(lColumn, lSort, lSeq)
{
lSeq = this.Seq(lColumn, lSort, lSeq);
var sRestOf = this.SortSeqA(lColumn, lSeq);
return sRestOf;
}
function A_Seq(lColumn, lSort, lSeq)
{
if (lColumn == lSort)
{
if (lSeq == 0)
lSeq = 1;
else
lSeq = 0;
}
else
lSeq = 0;
return lSeq;
}
function A_CookiesEnabled()
{
var bOk = true;
var fCookieMsg = "Cookies must be enabled for this web site.";
if (this.bMobile)
{
if (document.cookie == null)
{
this.DivError("Turn on cookies.", false);
bOk = false;
}
else
if (document.cookie.length == IS_EMPTY)
{
this.DivError(fCookieMsg, false);
bOk = false;
}
}
else
{
if (! navigator.cookieEnabled)
{
this.DivError(fCookieMsg, false);
bOk = false;
}
}
return bOk;
}
function A_Exists(oTable, eColumn, sValue)
{
if (oTable == null) return true;
if (eColumn < 1) return true;
if (sValue.length == IS_EMPTY) return true;
var sLower = sValue.toLowerCase();
var i = 0;
var sCell = fEmptyString;
for (i = 0; i < oTable.rows.length; i++)
{
sCell = this.InnerG(oTable.rows[i].cells[eColumn - 1]);
if (sLower == sCell.toLowerCase())
{
g_Message("The value '" + sValue + "' already exists.");
return true;
}
}
return false;
}
function A_AddPrompt(sMessage, lMinimum)
{
var sDescription = fEmptyString;
var vTextData = window.prompt(sMessage, sDescription);
if (vTextData == null)
return fEmptyString;
if (vTextData.length == IS_EMPTY)
{
g_Message("Specify a value before clicking OK.");
return fEmptyString;
}
if (vTextData.length < lMinimum)
{
g_Message("Enter a value of at least " + lMinimum + " characters.\n" + vTextData);
return fEmptyString;
}
sDescription = vTextData;
return sDescription;
}
function A_EditPrompt(sMessage, sDescription, lMinimum)
{
var sSave = sDescription;
var vTextData = window.prompt(sMessage, sDescription);
if (vTextData == null)
return fEmptyString;
if (vTextData.length == IS_EMPTY)
{
g_Message("Specify a value before click OK.");
return fEmptyString;
}
if (vTextData.length < lMinimum)
{
g_Message("Enter a value of at least " + lMinimum + " characters.\n" + vTextData);
return fEmptyString;
}
sDescription = vTextData;
if (sDescription == sSave)
{
g_Message("Modify the value before clicking OK.");
return fEmptyString;
}
return sDescription;
}
function A_Show(oDiv)
{
oDiv.style.display = fBlock;
}
function A_Hide(oDiv)
{
oDiv.style.display = fNone;
}
function A_NoChanges(sForm)
{
g_Message("No changes have been made to the " + sForm + " field(s).");
}
function A_IsNumeric(oEdit, sFrom)
{
var bOk = true;
var sNumeric = oEdit.value;
sNumeric = this.StripCommas(sNumeric);
if (sNumeric.length == IS_EMPTY)
{
return true;
}
else
if (! isNaN(sNumeric))
{
oEdit.value = sNumeric;
}
else
{
g_Message("Invalid numeric character in " + sFrom + " field: " + sNumeric);
with (oEdit)
{
focus();
select();
}
bOk = false;
}
return bOk;
}
function A_IsWellFormed(oEdit)
{
if (this.ValidateTagsA(oEdit)) return false;
var bOk = true;
oEdit.value = this.Trim(oEdit.value);
if (oEdit.value.length < emlPhone)
bOk = false;
return bOk;
}
function V_InternetZone()
{
var bIntranet = this.IsIntranet(document.domain);
return (! bIntranet);
}
function A_Customer(oTable, oAnchor, sDialog, eFrom)
{
var sDataPath = this.GetDataPath();
if (sDataPath.length == IS_EMPTY)
return false;
var sFilename = sDataPath + sDialog + ".csv";
var bOk = this.Export(oTable, oAnchor, sFilename, eFrom);
return bOk;
}
function A_GetDataPath()
{
var fDataPath = "DataPath";
var sDataPath = this.GetCookie(fDataPath);
if (sDataPath == null)
sDataPath = fEmptyString;
var bXpSp2 = this.IsXpSp2();
var bInternet = this.InternetZone();
var bUnc = (bXpSp2 || bInternet);
var sMessage = fEmptyString;
if (bUnc)
{
sMessage = "Enter a shared directory (UNC) name to save the CSV file. E.g. \\\\machine\\MyFiles.";
}
else
{
sMessage = "Enter a directory name to save the CSV file. Shared directory (UNC) names are recommended.";
}
var vTextData = window.prompt(sMessage, sDataPath);
if (vTextData == null)
return fEmptyString;
if (vTextData.length == IS_EMPTY)
return fEmptyString;
sDataPath = vTextData;
var lLength = sDataPath.length;
if (lLength < 5) return fEmptyString;
var sLastChar = sDataPath.charAt(lLength - ePos1);
var fBackSlash = "\\";
var fBsBs = "\\\\";
if (sLastChar != fBackSlash)
sDataPath += fBackSlash;
this.SetCookie(fDataPath, sDataPath, false);
var bValidPath = true;
if (bUnc)
{
var sPrefix = sDataPath.substr(eFirstChar, 2);
if (sPrefix != fBsBs)
{
g_Message(sDataPath + " is not a valid shared (UNC) directory.");
sDataPath = fEmptyString;
}
}
return sDataPath;
}
function A_IsXpSp2()
{
var sAgent = navigator.userAgent.toLowerCase();
var bReturn = false;
if (sAgent.indexOf("windows nt 5.1; sv1") != S_N_F)
{
bReturn = true;
}
else
if (sAgent.indexOf("windows nt 6") != S_N_F)
{
bReturn = true;
}
else
if (sAgent.indexOf("windows nt 5.2; sv1") != S_N_F)
{
bReturn = true;
}
return bReturn;
}
function A_SetCookie(sName, sValue, bExpire)
{
var sCookie = sName + "=" + escape(sValue) + "; ";
if (! bExpire)
{
var oDate = new Date();
oDate.setMonth(oDate.getMonth() + 1);
sCookie += ("; expires=" + oDate.toUTCString());
}
document.cookie = sCookie;
return true;
}
function A_GetCookie(sName)
{
var sCookie = document.cookie.split("; ");
var sCrumb = fEmptyString;
for (var i = 0; i < sCookie.length; i++)
{
sCrumb = sCookie[i].split("=");
if (sName == sCrumb[0])
return unescape(sCrumb[1]);
}
return null;
}
function A_Stripes(oTable)
{
oTable.ro_Adjust();
var bOk = this.Status("Ready");
return bOk;
}
function A_ClickCalendar(oEdit, oCalendar, oDiv)
{
if (this.bMobile)
{
return true;
}
var bOk = false;
if (oCalendar.value != null)
{
bOk = this.CalFillDate(oEdit, oCalendar);
this.Toggle(oDiv);
oEdit.focus();
}
return bOk;
}
function A_ToggleCalendar(oEdit, oCalendar, oDiv)
{
if (this.bMobile)
{
return true;
}
var sMask = oEdit.value;
var bOk = true;
if (sMask.length > IS_EMPTY)
{
var sValue = this.Trim(sMask);
if (! this.ValDate(sValue))
{
oEdit.focus();
return false;
}
var lMilliDate = Date.parse(sValue);
if (isNaN(lMilliDate))
{
g_Message("Invalid date: " + sValue);
return false;
}
var lPos = sValue.indexOf(fBlank);
if (lPos > S_N_F)
{
sValue = sValue.substr(eFirstChar, lPos);
}
try
{
oCalendar.value = sValue;
}
catch (exception)
{
g_Message("Invalid mask date: " + sValue);
return false;
}
}
this.Toggle(oDiv);
return bOk;
}
function A_CalFillDate(oEdit, oCalendar)
{
var bOk = true;
if (this.bMobile)
{
return true;
}
if (oCalendar == null) return false;
if (oCalendar.value == null) return false;
oEdit.value = oCalendar.value;
oEdit.realValue = oCalendar.value;
return bOk;
}
function A_Inspect(sFilename)
{
if (this.bMobile)
{
return true;
}
var bOk = true;
return bOk;
}
function A_Export(oTable, oAnchor, sFilename, eFrom)
{
if (oTable == null) return false;
if (oAnchor == null) return false;
if (sFilename.length == IS_EMPTY) return false;
if (! this.ActiveX()) return false;
var oFSO = null;
var sProgId = "Scripting.FileSystemObject";
try
{
oFSO = new ActiveXObject(sProgId);
}
catch (exception)
{
g_Message("Failed to allocate '" + sProgId + "'.\n" + this.FormatE(exception));
return false;
}
var oTS = null;
try
{
oTS = oFSO.CreateTextFile(sFilename, true);
}
catch (exception)
{
if (this.ProtectedMode(exception))
{
g_Message("Windows Vista (and above) requires Protected Mode to be turned off for the security zone in order to create a file.");
}
else
g_Message("Error creating output file '" + sFilename + "'.\nClose the file if it is open in Excel and retry.\n" + this.FormatE(exception));
return false;
}
var bOk = true;
var sRow = fEmptyString;
var sCell = fEmptyString;
var oRow = null;
var oCell = null;
var i = 0;
var j = 0;
var lCells = 0;
var fSemiColon = ";";
for (i = 0; i < oTable.rows.length; i++)
{
oRow = oTable.rows[i];
sRow = fEmptyString;
lCells = oRow.cells.length;
for (j = 0; j < lCells; j++)
{
if (j % 2 == 0)
{
oCell = oRow.cells[j];
sCell = this.InnerG(oCell);
re = /"/g;
sCell = sCell.replace(re, "'");
re = /,/g;
if (oCell.align == "right")
sCell = sCell.replace(re, fEmptyString);
else
sCell = sCell.replace(re, fPeriod);
re = /\r\n/g;
sCell = sCell.replace(re, fSemiColon);
re = /\r/g;
sCell = sCell.replace(re, fSemiColon);
re = /\n/g;
sCell = sCell.replace(re, fSemiColon);
re = /[\x80-\xff]/g;
sCell = sCell.replace(re, fPeriod);
if (j == (lCells - 1))
sRow += sCell;
else
sRow += (sCell + ",");
}
}
oTS.WriteLine(sRow);
}
oTS.Close();
delete oTS;
delete oFSO;
oAnchor.href = sFilename;
this.ClickB(oAnchor);
return bOk;
}
function A_Mobile()
{
this.bMobile = true;
this.Gecko();
}
function A_IsMobile()
{
return this.bMobile;
}
function A_LetMobile(bValue)
{
this.bMobile = bValue;
if (bValue)
{
this.Gecko();
}
}
function A_InitRealValue(oEdit)
{
var bOk = this.RealValue(oEdit, fEmptyString);
return bOk;
}
function A_Href(oAnchor, sHref)
{
var bOk = true;
if (this.bMobile)
{
bOk = false;
}
else
{
oAnchor.href = sHref;
}
return bOk;
}
function A_Status(sMessage)
{
var bOk = true;
if (this.bMobile)
{
/*jsl:pass*/
}
else
{
window.status = sMessage;
}
return bOk;
}
function A_KeyDown()
{
var bOk = true;
if (this.bMobile)
{
return true;
}
var lKeyCode = event.keyCode;
var vbKeyC = 67;
var vbKeyReturn = 13;
if (event.ctrlKey || event.ctrlLeft)
{
switch (lKeyCode)
{
case vbKeyC:
case 86:
return true;
default: break;
}
}
if (event.altKey ||
event.altLeft ||
event.ctrlKey ||
event.ctrlLeft ||
event.shiftKey ||
event.shiftLeft)
{
event.returnValue = false;
return false;
}
if (lKeyCode == vbKeyReturn)
return true;
if ((lKeyCode >= 48) && (lKeyCode <= 57))
{
/*jsl:pass*/
}
else
if ((lKeyCode >= 96) && (lKeyCode <= 105))
{
/*jsl:pass*/
}
else
{
switch (lKeyCode)
{
case 8:
case 9:
case 35:
case 36:
case 37:
case 39:
case 46:
break;
default:
event.returnValue = false;
break;
}
}
return bOk;
}
function A_NumericWID(oEdit)
{
var bOk = true;
var sNumeric = oEdit.value;
sNumeric = this.StripCommas(sNumeric);
if (sNumeric.length == IS_EMPTY)
{
/*jsl:pass*/
}
else
if (! isNaN(sNumeric))
{
oEdit.value = sNumeric;
}
else
{
g_Message("Invalid numeric character in work item number field: " + sNumeric);
with (oEdit)
{
focus();
select();
}
bOk = false;
}
return bOk;
}
function A_Toggle(oDiv)
{
var bOk = true;
if (this.bMobile || this.bGecko)
{
this.ToggleC(oDiv);
}
else
{
if (this.IsHidden(oDiv))
{
oDiv.style.display = fBlock;
}
else
{
oDiv.style.display = fNone;
}
bOk = true;
}
return bOk;
}
function A_StripCommas(sNumeric)
{
var sReturn = fEmptyString;
if (sNumeric.length == IS_EMPTY)
{
return sNumeric;
}
re = /,/g;
sNumeric = sNumeric.replace(re, fEmptyString);
sReturn = sNumeric;
return sReturn;
}
function A_Trim(sValue)
{
if (this.ValidateTags(sValue, true)) return false;
var sReturn = fEmptyString;
if (sValue.length == IS_EMPTY) return sValue;
var bMore = true;
while (bMore)
{
if (sValue.length == IS_EMPTY) return sValue;
if (sValue.charAt(eFirstChar) == fBlank)
sValue = sValue.substr(1);
else
bMore = false;
}
bMore = true;
var lLength = IS_EMPTY;
while (bMore)
{
lLength = sValue.length;
if (lLength == IS_EMPTY) return sValue;
if (sValue.charAt(lLength - ePos1) == fBlank)
sValue = sValue.substr(eFirstChar, lLength - ePos1);
else
bMore = false;
}
sReturn = sValue;
return sReturn;
}
function A_Concatenate(oSelect, sSeparator)
{
if (oSelect == null)
{
g_Message(f372);
return fEmptyString;
}
var lLen = oSelect.options.length;
if (lLen == eZeroCount)
{
g_Message("Empty listbox");
return fEmptyString;
}
var csa = new Array;
for (var i = eZeroCount; i <= (lLen - 1); i++)
{
csa.push(oSelect.options.item(i).value);
}
var sSelection = csa.join(sSeparator);
return sSelection;
}
function A_Lb2Lb(oListFrom, oListTo)
{
if (oListFrom == null)
{
g_Message(f372);
return false;
}
if (oListTo == null)
{
g_Message(f372);
return false;
}
var bOk = true;
var oOptionsFrom = oListFrom.options;
var nCount = oOptionsFrom.length;
if (nCount < eFirstItem)
return false;
var oFrom = null;
for (var i = eFirstItem; i < nCount; i++)
{
oFrom = oOptionsFrom.item(i);
if (this.bMobile)
{
oFrom.selected = false;
bOk = this.AddOptionM(oListTo, oFrom, i);
}
else
{
bOk = this.AddOption(oListTo, oFrom);
}
}
if (this.bMobile)
{
oOptionsFrom.length = eFirstItem;
return true;
}
var oOptionDel = null;
for (i = eFirstItem; i < nCount; i++)
{
oOptionDel = oOptionsFrom.item(i);
oOptionDel = null;
oOptionsFrom.remove(eFirstItem);
}
bOk = true;
return bOk;
}
function A_OneItem(oListFrom, oListTo)
{
if (oListFrom == null)
{
g_Message(f372);
return false;
}
if (oListTo == null)
{
g_Message(f372);
return false;
}
var bOk = true;
var n = oListFrom.selectedIndex;
if (n < eFirstItem)
return false;
var oFrom = oListFrom.options.item(n);
if (oFrom == null)
{
g_Message("Unable to access item " + n + " from the list.");
return false;
}
if (this.bMobile)
{
oFrom.selected = false;
bOk = this.AddOptionM(oListTo, oFrom, n);
}
else
{
bOk = this.AddOption(oListTo, oFrom);
}
oFrom = null;
try
{
oListFrom.remove(n);
}
catch (exception)
{
g_Message("Unable to remove item " + n + " from the list.");
}
bOk = true;
return bOk;
}
function V_AddOption(oListTo, oFrom)
{
var oOption = document.createElement("OPTION");
with (oOption)
{
text = oFrom.text;
value = oFrom.value;
}
oListTo.options.add(oOption);
return true;
}
function A_SelectedValue(oBox)
{
if (oBox == null)
{
g_Message(f372);
return fEmptyString;
}
var sValue = fEmptyString;
var n = oBox.selectedIndex;
if (n >= eFirstItem)
{
sValue = oBox.options.item(n).value;
}
return sValue;
}
function A_Selected(oBox)
{
if (oBox == null)
{
g_Message(f372);
return fEmptyString;
}
var sValue = fEmptyString;
var n = oBox.selectedIndex;
if (n >= eFirstItem)
{
sValue = oBox.options.item(n).text;
}
return sValue;
}
function A_FindValueNumber(oList, lValue)
{
var bOk = true;
if (isNaN(lValue))
{
bOk = this.FindValue(oList, lValue);
}
else
{
bOk = this.FindValue(oList, lValue.toString());
}
return bOk;
}
function A_FindValue(oList, sValue)
{
if (oList == null)
{
g_Message(f372);
return false;
}
var bOk = true;
var oOptions = oList.options;
if (oOptions == null)
{
g_Message("oOptions null");
return false;
}
var nCount = oOptions.length;
if (nCount < eZeroCount)
return false;
var oOptionFind = null;
var sLower = fEmptyString;
for (var i = eFirstItem; i < nCount; i++)
{
oOptionFind = oOptions.item(i);
sLower = oOptionFind.value;
if (sLower == sValue)
{
bOk = this.SetSelected(oList, i);
return true;
}
}
return false;
}
function A_Find(oList, sValue)
{
if (oList == null)
{
g_Message(f372);
return false;
}
var bFound = true;
var oOptions = oList.options;
var nCount = oOptions.length;
if (nCount < eFirstItem)
return false;
var oOptionFind = null;
sValue = sValue.toLowerCase();
var sLower = fEmptyString;
for (var i = eFirstItem; i < nCount; i++)
{
oOptionFind = oOptions.item(i);
sLower = oOptionFind.text;
sLower = sLower.toLowerCase();
if (sLower == sValue)
{
var bOk = this.SetSelected(oList, i);
return bOk;
}
}
bFound = false;
return bFound;
}
function A_InitSelected(oBox)
{
var bOk = this.SetSelected(oBox, eFirstItem);
return bOk;
}
function A_SetSelected(oBox, lIndex)
{
var bOk = true;
try
{
oBox.selectedIndex = lIndex;
}
catch (exception)
{
g_Message("Ppc.SetSelected: lIndex: " + lIndex + fNewLine + this.FormatE(exception));
bOk = false;
}
return bOk;
}
function A_IsFirst(oBox)
{
var bFirst = false;
try
{
bFirst = (oBox.selectedIndex == eFirstItem);
}
catch (exception)
{
g_Message("Ppc.IsFirst: " + this.FormatE(exception));
}
return bFirst;
}
function A_GetSelected(oBox)
{
var lIndex = eFirstItem;
try
{
lIndex = oBox.selectedIndex;
}
catch (exception)
{
g_Message("Ppc.GetSelected: " + this.FormatE(exception));
}
return lIndex;
}
function A_Profile()
{
var bOk = true;
if (this.bMobile)
{
bOk = false;
}
return bOk;
}
function A_RealValueIsEmpty(oEdit)
{
var bEmpty = true;
if (this.bMobile)
{
bEmpty = false;
}
else
{
bEmpty = (oEdit.realValue.length == IS_EMPTY);
}
return bEmpty;
}
function A_RealValue(oEdit, sValue)
{
var bOk = true;
oEdit.value = sValue;
if (this.bMobile)
{
bOk = false;
}
else
{
oEdit.realValue = sValue;
}
return bOk;
}
function A_ClickB(oAnchor)
{
var bOk = true;
if (this.bMobile || this.bGecko)
{
window.open(oAnchor.href);
}
else
{
oAnchor.click();
}
return bOk;
}
function A_Click(oAnchor)
{
if (oAnchor == null)
{
g_Message("Anchor not allocated (defined).");
return false;
}
var bOk = true;
if (this.bMobile || this.bGecko)
{
document.location.href = oAnchor.href;
return false;
}
else
{
try
{
oAnchor.click();
}
catch (exception)
{
g_Message("Ppc.Click: " + this.FormatE(exception));
bOk = false;
}
}
return bOk;
}
