//Copyright Stellent Colorado Springs Inc. All rights reserved. var AES_Error_1; var AES_Error_2; var AES_Error_3; var AES_Error_4; var AES_Error_5; var AES_Error_6; var AES_Error_7; var AES_Error_8; var AES_Error_9; var AES_Error_10; var AES_Error_11; var AES_Error_12; var AES_Error_13; function _InitializeAcordeEventSupportCode() { if(typeof(AES_Error_1) == 'undefined') { AES_Error_1 = 'Error#1 AcordeEvent:'; AES_Error_2 = 'Error#2 AcordeEvent:'; AES_Error_3 = 'Error#3 AcordeEvent:'; AES_Error_4 = 'Error#4 AcordeEvent:'; AES_Error_5 = 'Error#5 AcordeEvent:'; AES_Error_6 = 'Error#6 AcordeEvent:'; AES_Error_7 = 'Error#7 AcordeEvent:'; AES_Error_8 = 'Error#8 AcordeEvent:'; AES_Error_9 = 'Error#9 AcordeEvent:'; AES_Error_10 = 'Error#10 AcordeEvent:'; AES_Error_11 = 'Error#11 AcordeEvent:'; AES_Error_12 = 'Error#12 AcordeEvent:'; AES_Error_13 = 'Error#13 AcordeEvent:'; } } function CreateAcordeClientEvent(strSourceID, strEventID) { return new AcordeClientEvent(strSourceID, strEventID); } function AcordeClientEvent(strSourceID, strEventID) { _InitializeAcordeEventSupportCode(); this.SourceID = strSourceID; this.EventID = strEventID; this.ExactFunction = 'Acorde_' + this.SourceID + '_' + this.EventID; this.GeneralFunction = 'Acorde_All_' + this.EventID; this.RunGeneralFunctions = false; function _SetRunGeneralFunctions() { this.RunGeneralFunctions = true; } this.SetRunGeneralFunctions = _SetRunGeneralFunctions; this.m_bScanForOneTrue = false; function _SetScanForOneTrue() { this.m_bScanForOneTrue = true; } this.SetScanForOneTrue = _SetScanForOneTrue; this.m_objIntitialTargetWindow = null; function _SetTargetWindow(objWindow) { this.m_objIntitialTargetWindow = objWindow; } this.SetTargetWindow = _SetTargetWindow; function _FindAndFireAllEvents(strFrameTarget, varParam, strExactFunction, strGeneralFunction, bGenFunction, objReturnValues) { if(this.m_bOneOnly && objReturnValues.length > 0) { return objReturnValues; } var b1 = true; var strCheckForFramesCode = 'if(typeof('+strFrameTarget+')!="object" || typeof('+strFrameTarget+'.frames)!="object"){b1=false;}'; eval(strCheckForFramesCode); if(!b1) { return objReturnValues; } var objFramesCollection = eval(strFrameTarget + ".frames"); var iFramesCount = objFramesCollection.length; if(this.m_bDebugEvent) { alert("looking for ["+strExactFunction+"] in frame [" + strFrameTarget + "] return values length = ["+objReturnValues.length+"]"); } if (iFramesCount > 0) { for(var i = 0; i < iFramesCount; i++) { this.FindAndFireAllEvents(strFrameTarget + ".frames[" + i + "]", varParam, strExactFunction, strGeneralFunction, bGenFunction, objReturnValues); } if(this.m_bOneOnly && objReturnValues.length > 0) { return objReturnValues; } } else { var strFunctionName = strFrameTarget + '.' + strExactFunction; var strCheckForFunctionCode = 'var b = true; if(typeof(' + strFunctionName + ') == "undefined"){b = false;}'; var bNameExists = eval(strCheckForFunctionCode); if (b) { var fnFunction = eval(strFunctionName) if (typeof(fnFunction) == "function" || typeof(fnFunction) == "object") { if(this.m_bDebugEvent) { alert("Function ["+strExactFunction+"] FOUND in frame [" + strFrameTarget + "]"); } var strFireCode = eval(strFunctionName); var CurrentRtnValue = null; if(typeof(varParam) != 'undefined') { CurrentRtnValue = strFireCode(varParam); } else { CurrentRtnValue = strFireCode(); } if(typeof(CurrentRtnValue) != 'undefined' && CurrentRtnValue != null) { objReturnValues[objReturnValues.length] = CurrentRtnValue; } else { if(this.m_bOneOnly) { objReturnValues[objReturnValues.length] = -1; } } if(this.m_bOneOnly) { return objReturnValues; } } else { if(this.m_bDebugEvent) { alert("Function name ["+strExactFunction+"] FOUND in frame [" + strFrameTarget + "] but not a function its type is["+typeof(fnFunction)+"]"); } } } else { if(this.m_bDebugEvent) { alert("Function ["+strExactFunction+"] NOT in frame [" + strFrameTarget + "]"); } } if(bGenFunction == true) { var strFunctionName = strFrameTarget + '.' + strGeneralFunction; var strCheckForFunctionCode = 'var b = true; if(typeof(' + strFunctionName + ') == "undefined"){b = false;}'; var bNameExists = eval(strCheckForFunctionCode); if (b) { var fnFunction = eval(strFunctionName) var strCurrentRntValue = null; if (typeof(fnFunction) == "function") { var strFireCode = eval(strFunctionName); if(typeof(varParam) != 'undefined') { strCurrentRntValue = strFireCode(varParam); } else { strCurrentRntValue = strFireCode(); } if(typeof(CurrentRtnValue) != 'undefined' && CurrentRtnValue != null) { objReturnValues[objReturnValues.length] = strCurrentRntValue; } } } } } return objReturnValues; } this.FindAndFireAllEvents = _FindAndFireAllEvents; this.m_bDebugEvent = false; function _SetDebug() { this.m_bDebugEvent = true; } this.SetDebug = _SetDebug; this.m_bOneOnly = false; function _SetOneOnly() { this.m_bOneOnly = true; } this.SetOneOnly = _SetOneOnly; this.m_bPropagateToOpener = false; function _SetPropagateToOpener() { this.m_bPropagateToOpener = true; } this.SetPropagateToOpener = _SetPropagateToOpener; this.m_bP2NW = false; function _SetPropagateToNewWindows() { this.m_bP2NW = true; } this.SetPropagateToNewWindows = _SetPropagateToNewWindows; function _FireEvent(varParam) { var objReturnValues = new Array; var objRV = null; if(this.m_objIntitialTargetWindow != null) { if(typeof(this.m_objIntitialTargetWindow.CreateAcordeClientEvent) != "undefined") { var objNewACE = this.m_objIntitialTargetWindow.CreateAcordeClientEvent(this.SourceID, this.EventID); if(this.m_bDebugEvent) { objNewACE.SetDebug(); } if(this.m_bOneOnly) { objNewACE.SetOneOnly(); } if(this.m_bPropagateToOpener) { objNewACE.SetPropagateToOpener(); } if(this.RunGeneralFunctions) { objNewACE.SetRunGeneralFunctions(); } if(this.m_bP2NW) { objNewACE.SetPropagateToNewWindows(); } strReturnValue = objNewACE.FireEvent(varParam); } } else { objRV = this.FindAndFireAllEvents('top', varParam, this.ExactFunction, this.GeneralFunction, this.RunGeneralFunctions, objReturnValues); var strReturnValue; if(objRV.length == 0 && this.m_bPropagateToOpener) { if(typeof(top.opener) != 'undefined') { objRV = this.FindAndFireAllEvents('top.opener.top', varParam, this.ExactFunction, this.GeneralFunction, this.RunGeneralFunctions, objReturnValues); } } if(objRV.length > 0) { strReturnValue = objRV[0]; if(objRV.length > 1) { if(this.m_bScanForOneTrue) { strReturnValue = false; for(var r = 0 ; r < objRV.length; r++) { if(objRV[r] == true) { strReturnValue = true; } } } } } } if(this.m_bP2NW) { var objNWPACE = new AcordeClientEvent("Infrastructure","onPropagateEventToNewWindows"); var objEventInfo = new Object(); objEventInfo.NS = this.SourceID; objEventInfo.EN = this.EventID; objEventInfo.Data = varParam; var bRetValFromNW = objNWPACE.FireEvent(objEventInfo); if(typeof(bRetValFromNW) != 'undefined') { if(typeof(bRetValFromNW.length)) { if(typeof(strReturnValue) == 'undefined') { strReturnValue = bRetValFromNW; } else { } } else { if(typeof(strReturnValue) == 'undefined') { strReturnValue = bRetValFromNW; } else { } } } } return strReturnValue; } this.FireEvent = _FireEvent; function _FindAllEvents(strFrameTarget, strExactFunction) { var objFramesCollection = eval(strFrameTarget + ".frames"); var iFramesCount = objFramesCollection.length; if (iFramesCount > 0) { var bFound = false; for(var i = 0; i < iFramesCount; i++) { bFound = this.FindAllEvents(strFrameTarget + ".frames[" + i + "]", strExactFunction); if(bFound) { return true; } } return false; } else { var strFunctionName = strFrameTarget + '.frames.' + strExactFunction; var strCheckForFunctionCode = 'var b = true; if(typeof(' + strFunctionName + ') == "undefined"){b = false;}'; var bNameExists = eval(strCheckForFunctionCode); if (b) { var fnFunction = eval(strFunctionName) if (typeof(fnFunction) == "function") { return true; } else { if(this.m_bDebugEvent) { alert("Function name ["+strExactFunction+"] FOUND in frame [" + strFrameTarget + "] but not a function"); } return false; } } else { if(this.m_bDebugEvent) { alert("Function ["+strExactFunction+"] NOT in frame [" + strFrameTarget + "]"); } return false; } } return false; } this.FindAllEvents = _FindAllEvents; function _EventExists() { var objRV = this.FindAllEvents('top', this.ExactFunction); return objRV; } this.EventExists = _EventExists; }