
function cApplication()
{
this.oMainWindow = window;
this.oTopMostWindow = window;
this.fIsContentChanged = false;
this.fAskSSCIfRequired = true;
this.sAppHelpURL = null;
this.sPageHelpTopic = null;
this.nSSCUseConfig = null;
this.sAppName = null;
this.sAuthParamPrefix = null;
}
function setpt_cApplication()
{
cApplication.prototype.ShowPageContent = cApplication_ShowPageContent;
cApplication.prototype.SetContentChanged = cApplication_SetContentChanged;
cApplication.prototype.ClearContentChanged = cApplication_ClearContentChanged;
cApplication.prototype.SetAuthCookie = cApplication_SetAuthCookie;
cApplication.prototype.DelAuthCookie = cApplication_DelAuthCookie;
cApplication.prototype.ManageSSC = cApplication_ManageSSC;
cApplication.prototype.OnAppError = cApplication_OnAppError;
cApplication.prototype.InfoDlg = cApplication_InfoDlg;
cApplication.prototype.WaitDlg = cApplication_WaitDlg;
cApplication.prototype.ConfirmDlg = cApplication_ConfirmDlg;
cApplication.prototype.ConfirmWithReasonDlg = cApplication_ConfirmWithReasonDlg;
cApplication.prototype.YesNoCancelDlg = cApplication_YesNoCancelDlg;
cApplication.prototype.CalendarDlg = cApplication_CalendarDlg;
cApplication.prototype.Help_DispTopic = cApplication_Help_DispTopic;
cApplication.prototype.ParseNum = cApplication_ParseNum;
cApplication.prototype.ParseDT = cApplication_ParseDT;
cApplication.prototype.FormatDT = cApplication_FormatDT;
cApplication.prototype.EncStr4HTML = cApplication_EncStr4HTML;
cApplication.prototype.EncStrLiteral4JScript = cApplication_EncStrLiteral4JScript;
cApplication.prototype.FuncCall_Stub = FuncCall_Stub;
}
function cApplication_ShowPageContent(
fLoaded
)
{
document.all("oDIV_PageContent_Loaded").style.display = (fLoaded ? "block" : "none");
document.all("oDIV_PageContent_Loading").style.display = (fLoaded ? "none" : "block");
document.body.focus();
}
function cApplication_SetContentChanged()
{
this.fIsContentChanged = true;
document.all("oTR_Page_ChangedSignal").style.display = "block";
}
function cApplication_ClearContentChanged()
{
this.fIsContentChanged = false;
document.all("oTR_Page_ChangedSignal").style.display = "none";
}
function cApplication_SetAuthCookie(
sName,
sVal
)
{
var s = this.sAuthParamPrefix+sName;
DeleteCookie(s);
SetCookie(s, sVal);
}
function cApplication_DelAuthCookie(
sName
)
{
var s = this.sAuthParamPrefix+sName;
DeleteCookie(s);
}
function cApplication_ManageSSC(
fESign
)
{
var sSSC;
if (!this.fAskSSCIfRequired)
return;
if ((this.nSSCUseConfig == 2) || ((this.nSSCUseConfig == 1) && fESign))
{
sSSC = this.oTopMostWindow.showModalDialog( "Dlg_SSC.asp", [GL_oApplication],
"dialogWidth:280px;dialogHeight:200px;center:1;help:0;resizable:1;scroll:1;status:0;");
if (sSSC != null) {
this.SetAuthCookie("SSC", sSSC);
this.fAskSSCIfRequired = false;
}
}
}
function cApplication_OnAppError(
eobj
)
{
alert( typeof(eobj) == "string" ? eobj : eobj.description, "Error", false );
}
function cApplication_InfoDlg(
sMsg,
sTitle,
sHelpTopic,
nWidth,
nHeight
)
{
this.oTopMostWindow.showModalDialog( "Dlg_Info.asp?Msg="+ escape(sMsg) +
"&Title="+ escape(sTitle == null ? "Information" : sTitle) +
(sHelpTopic == null ? "" : "&HelpTopic="+escape(sHelpTopic)),
[GL_oApplication, sMsg],
"dialogWidth:"+ (nWidth == null ? 400 : nWidth) +"px;"+
"dialogHeight:"+ (nHeight == null ? 200 : nHeight) +"px;"+
"center:1;help:0;resizable:1;scroll:1;status:0;");
}
function cApplication_WaitDlg(
nMSec,
sMsg,
sTitle,
nWidth,
nHeight
)
{
if (sMsg == null)
{
sMsg = "Please wait...";
}
this.oTopMostWindow.showModalDialog( "Dlg_Wait.asp?Msg="+ escape(sMsg) +
"&Title="+ escape(sTitle == null ? "Wait" : sTitle),
[GL_oApplication, sMsg, nMSec],
"dialogWidth:"+ (nWidth == null ? 400 : nWidth) +"px;"+
"dialogHeight:"+ (nHeight == null ? 200 : nHeight) +"px;"+
"center:1;help:0;resizable:1;scroll:1;status:0;");
}
function cApplication_ConfirmDlg(
sMsg,
sTitle,
sHelpTopic,
nWidth,
nHeight
)
{
return( this.oTopMostWindow.showModalDialog( "Dlg_Confirm.asp?Msg="+ escape(sMsg) +
"&Title="+ escape(sTitle == null ? "Confirm" : sTitle) +
(sHelpTopic == null ? "" : "&HelpTopic="+escape(sHelpTopic)),
[GL_oApplication, sMsg],
"dialogWidth:"+ (nWidth == null ? 400 : nWidth) +"px;"+
"dialogHeight:"+ (nHeight == null ? 200 : nHeight) +"px;"+
"center:1;help:0;resizable:1;scroll:1;status:0;") );
}
function cApplication_ConfirmWithReasonDlg(
sMsg,
sTitle,
sHelpTopic,
nWidth,
nHeight
)
{
return( this.oTopMostWindow.showModalDialog( "Dlg_ConfirmWithReason.asp?Msg="+ escape(sMsg) +
"&Title="+ escape(sTitle == null ? "Confirm with Comment" : sTitle) +
(sHelpTopic == null ? "" : "&HelpTopic="+escape(sHelpTopic)),
[GL_oApplication, sMsg],
"dialogWidth:"+ (nWidth == null ? 600 : nWidth) +"px;"+
"dialogHeight:"+ (nHeight == null ? 300 : nHeight) +"px;"+
"center:1;help:0;resizable:1;scroll:1;status:0;") );
}
function cApplication_YesNoCancelDlg(
sMsg,
sTitle,
sHelpTopic,
nWidth,
nHeight
)
{
return( this.oTopMostWindow.showModalDialog( "Dlg_YesNoCancel.asp?Msg="+ escape(sMsg) +
"&Title="+ escape(sTitle == null ? "Decision" : sTitle) +
(sHelpTopic == null ? "" : "&HelpTopic="+escape(sHelpTopic)),
[GL_oApplication, sMsg],
"dialogWidth:"+ (nWidth == null ? 400 : nWidth) +"px;"+
"dialogHeight:"+ (nHeight == null ? 200 : nHeight) +"px;"+
"center:1;help:0;resizable:1;scroll:1;status:0;") );
}
function cApplication_CalendarDlg(
sDTVal,
sTitle,
sHelpTopic,
nWidth,
nHeight
)
{
return( this.oTopMostWindow.showModalDialog( "Dlg_Calendar.asp?Title="+ escape(sTitle == null ? "Calendar" : sTitle) +
(sDTVal == null ? "" : "&DefDateTime="+escape(sDTVal)) +
(sHelpTopic == null ? "" : "&HelpTopic="+escape(sHelpTopic)),
[GL_oApplication],
"dialogWidth:"+ (nWidth == null ? 350 : nWidth) +"px;"+
"dialogHeight:"+ (nHeight == null ? 330 : nHeight) +"px;"+
"center:1;help:0;resizable:1;scroll:1;status:0;") );
}
function cApplication_Help_DispTopic(
sTopic
)
{
if (sTopic == null)
sTopic = this.sPageHelpTopic;
if (this.sAppHelpURL != null)
window.open(this.sAppHelpURL + (sTopic == null ? "" : "#"+sTopic),
this.sAuthParamPrefix+"_help",
"location=no,menubar=yes,resizable=yes,scrollbars=yes,status=no,toolbar=yes");
}
function cApplication_ParseNum(
sNum
)
{
var re;
re = new RegExp(",", "g");
sNum = sNum.replace(re, ".");
return( isNaN(sNum) || isNaN(parseFloat(sNum)) ? NaN : parseFloat(sNum) );
}
function cApplication_ParseDT(
sDT
)
{
var dt, re, pos, ms;
if (sDT == null)
return(null);
pos = sDT.indexOf(".");
if (pos > 0) {
pos = sDT.indexOf(".", pos+1);
if (pos > 0) {
pos = sDT.indexOf(".",pos+1);
if (pos > 0)
sDT = sDT.slice(0, pos) + sDT.slice(pos+1);
}
}
re = new RegExp("-", "g");
sDT = sDT.replace(re, "/");
re = new RegExp("\\.\\s", "g");
sDT = sDT.replace(re, "/");
re = new RegExp("\\.", "g");
sDT = sDT.replace(re, "/");
ms = Date.parse(sDT);
if (!isNaN(ms)) {
dt = new Date();
dt.setTime(ms);
}
else
dt = null;
return(dt);
}
function cApplication_FormatDT(
dVal,
fDateOnly
)
{
var year, month, day, hour, min, sec, msec;
if (dVal == null)
return("");
if (fDateOnly == null)
fDateOnly = false;
year = dVal.getFullYear();
month = dVal.getMonth()+1;
day = dVal.getDate();
hour = dVal.getHours();
min = dVal.getMinutes();
sec = dVal.getSeconds();
msec = dVal.getMilliseconds();
if (msec >= 500)
sec++;
if (sec == 60) {
sec = 0;
min++;
}
if (min == 60) {
min = 0;
hour++;
}
if (month < 10)
month = "0"+month;
if (day < 10)
day = "0"+day;
if (hour < 10)
hour = "0"+hour;
if (min < 10)
min = "0"+min;
if (sec < 10)
sec = "0"+sec;
return( year + "-" + month + "-" + day + (fDateOnly ? "" : " " + hour + ":" + min + ":" + sec) );
}
function cApplication_EncStr4HTML(
sVal
)
{
var re;
if (sVal == null)
return("");
re = new RegExp("<", "g");
sVal = sVal.replace(re, "&lt;");
re = new RegExp("\"", "g");
sVal = sVal.replace(re, "&quot;");
return( sVal );
}
function cApplication_EncStrLiteral4JScript(
sVal
)
{
var re;
if (sVal == null)
return("null");
re = new RegExp("\\\\", "g");
sVal = sVal.replace(re, "\\\\");
re = new RegExp("\"", "g");
sVal = sVal.replace(re, "\\\"");
re = new RegExp("\'", "g");
sVal = sVal.replace(re, "\\\'");
re = new RegExp("\\r", "g");
sVal = sVal.replace(re, "\\r");
re = new RegExp("\\n", "g");
sVal = sVal.replace(re, "\\n");
return( "'"+ sVal +"'" );
}
setpt_cApplication();
var GL_oApplication = new cApplication();
var GL_fIsLoaded = false;
var GL_nPageErrorCode = 0;
var GL_sPageMessage = null;
function BASE_Window_OnLoad(
fDelSSC
)
{
if (fDelSSC == null)
fDelSSC = true;
if (fDelSSC)
GL_oApplication.DelAuthCookie("SSC");
GL_oApplication.SetAuthCookie("Runs", "x");
GL_fIsLoaded = true;
GL_oApplication.ShowPageContent(true);
}
window.onload = BASE_Window_OnLoad;
function BASE_Window_OnBeforeUnload()
{
GL_oApplication.ManageSSC();
if (GL_oApplication.fIsContentChanged)
event.returnValue = "ATTENTION: Unsaved changes detected.";
else {
event.returnValue = undefined;
GL_oApplication.ShowPageContent(false);
}
}
window.onbeforeunload = BASE_Window_OnBeforeUnload;
function BASE_Window_OnUnload(
fDelRuns
)
{
if (fDelRuns == null)
fDelRuns = true;
if (fDelRuns)
GL_oApplication.DelAuthCookie("Runs");
}
window.onunload = BASE_Window_OnUnload;
function CheckBrowser()
{
var pos, ver, sp;
ver = 0;
sp = 0;
pos = window.navigator.appVersion.indexOf("MSIE");
if (pos > -1) {
ver = parseFloat(window.navigator.appVersion.slice(pos+4));
pos = window.navigator.appMinorVersion.toUpperCase().indexOf(";SP");
if (pos > -1)
sp = parseFloat(window.navigator.appMinorVersion.slice(pos+3));
}
if (ver < 6) {
window.location = "PAGE_PlainMsg.asp?Msg="+ escape( "WARNING: This application requires Microsoft Internet Explorer 6.0 or higher." );
return;
}
if (!window.navigator.cookieEnabled) {
window.location = "PAGE_PlainMsg.asp?Msg="+ escape( "WARNING: This application requires cookies to be enabled." );
return;
}
}
function GetCookie(
sName
)
{
var nStart, nEnd;
nStart = document.cookie.indexOf( sName+"=" );
if (nStart >= 0)
{
nStart += sName.length+1;
nEnd = document.cookie.indexOf(";", nStart);
if (nEnd == -1)
nEnd = document.cookie.length;
return( unescape( document.cookie.slice(nStart, nEnd) ) );
}
else
return(null);
}
function SetCookie(
sName,
sValue,
dExpires,
sPath,
sDomain,
fSecure
)
{
document.cookie = sName +"="+ escape(sValue)+
(dExpires == null ? "" : "; expires="+dExpires.toUTCString()) +
"; path="+ (sPath == null ? "/" : sPath) +
(sDomain == null ? "" : "; domain=" + sDomain) +
(fSecure == true ? "; secure" : "");
}
function DeleteCookie(
sName
)
{
SetCookie(sName, "");
}
function SetContentChanged()
{
GL_oApplication.SetContentChanged();
}
function ClearContentChanged()
{
GL_oApplication.ClearContentChanged();
}
