    //-------------------------------------------------------------
    var aCUSTOM_ERRORCODES = new Array();
    var aDEFAULT_ERRORCODES = new Array();
    var aCUSTOM_SUCCESSCODES = new Array();
    //-------------------------------------------------------------
    
    //-------------------------------------------------------------
    ERRORCODE = 0;
    ERRORMESSAGE = 1;
    DEFAULT_ERRORMESSAGE = "An error occured. The action was not successful.";
	//-------------------------------------------------------------
 
	//-------------------------------------------------------------
	SUCCESSCODE = 0;
	SUCCESSMESSAGE = 1;
	DEFAULT_SUCCEEDMESSAGE = "The action completed successfully.";
    //-------------------------------------------------------------
    
    //-------------------------------------------------------------
    //VBS RUN TIME ERROR CODES
    aDEFAULT_ERRORCODES[0] = [5,"Invalid procedure call or argument"];
    aDEFAULT_ERRORCODES[1] = [6,"Overflow"];
    aDEFAULT_ERRORCODES[2] = [7,"Out of Memory"];
    aDEFAULT_ERRORCODES[3] = [9,"Subscript out of range"];
    aDEFAULT_ERRORCODES[4] = [10,"This array is fixed or temporarily locked"];
    aDEFAULT_ERRORCODES[5] = [11,"Division by zero"];
    aDEFAULT_ERRORCODES[6] = [13,"Type mismatch"];
    aDEFAULT_ERRORCODES[7] = [14,"Out of string space"];
    aDEFAULT_ERRORCODES[8] = [17,"Can't perform requested operation"];
    aDEFAULT_ERRORCODES[9] = [28,"Out of stack space"];
    aDEFAULT_ERRORCODES[10] = [35,"Sub or function not defined"];
    aDEFAULT_ERRORCODES[11] = [48,"Error in loading DLL"];
    aDEFAULT_ERRORCODES[12] = [51,"Internal error"];
    aDEFAULT_ERRORCODES[13] = [91,"Object variable not set"];
    aDEFAULT_ERRORCODES[14] = [92,"For loop not initialized"]; 
    aDEFAULT_ERRORCODES[15] = [94,"Invalid use of Null"];
    aDEFAULT_ERRORCODES[16] = [424,"Object required"];
    aDEFAULT_ERRORCODES[17] = [429,"ActiveX component can't create object"];
    aDEFAULT_ERRORCODES[18] = [430,"Class doesn't support Automation"];
    aDEFAULT_ERRORCODES[19] = [432,"File name or class name not found during Automation operation"];
    aDEFAULT_ERRORCODES[20] = [438,"Object doesn't support this property or method"];
    aDEFAULT_ERRORCODES[21] = [445,"Object doesn't support this action"];
    aDEFAULT_ERRORCODES[22] = [447,"Object doesn't support current locale setting"];
    aDEFAULT_ERRORCODES[23] = [448,"Named argument not found"];
    aDEFAULT_ERRORCODES[24] = [449,"Argument not optional"];
    aDEFAULT_ERRORCODES[25] = [450,"Wrong number of arguments or invalid property assignment"];
    aDEFAULT_ERRORCODES[26] = [451,"Object not a collection"];
    aDEFAULT_ERRORCODES[27] = [458,"Variable uses an Automation type not supported in VBScript"];
    aDEFAULT_ERRORCODES[28] = [462,"The remote server machine does not exist or is unavailable"];
    aDEFAULT_ERRORCODES[29] = [481,"Invalid picture"];
    aDEFAULT_ERRORCODES[30] = [500,"Variable is undefined"];
    aDEFAULT_ERRORCODES[31] = [502,"Object not safe for scripting"];
    aDEFAULT_ERRORCODES[32] = [503,"Object not safe for initializing"];
    aDEFAULT_ERRORCODES[33] = [504,"Object not safe for creating"];
    aDEFAULT_ERRORCODES[34] = [505,"Invalid or unqualified reference"];
    aDEFAULT_ERRORCODES[35] = [506,"Class not defined"];
    aDEFAULT_ERRORCODES[36] = [507,"An exception occurred"];
    aDEFAULT_ERRORCODES[37] = [5008,"Illegal assignment"];
    aDEFAULT_ERRORCODES[38] = [5019,"Expected ']' in regular expression"];
    aDEFAULT_ERRORCODES[39] = [5020,"Expected ')' in regular expression"];
    aDEFAULT_ERRORCODES[40] = [5021,"Invalid range in character set"];
    aDEFAULT_ERRORCODES[41] = [5017,"Syntax error in regular expression"];
    aDEFAULT_ERRORCODES[42] = [5018,"Unexpected quantifier"];
    
    //FSO ERROR CODES
    aDEFAULT_ERRORCODES[43] = [52,"The file name is invalid or corrupt."];
    aDEFAULT_ERRORCODES[44] = [58,"A folder or file with this name already exists. Please select another name."];
	aDEFAULT_ERRORCODES[45] = [70,"Permission Denied."];
	aDEFAULT_ERRORCODES[46] = [76,"The path cannot be found."];
    
    //SQL SERVER ERROR CODES
	aDEFAULT_ERRORCODES[47] = [105,"Unclosed quotation marks."];
	aDEFAULT_ERRORCODES[48] = [156,"Incorrect syntax near a keyword."];
	aDEFAULT_ERRORCODES[49] = [170,"Incorrect syntax."];
	aDEFAULT_ERRORCODES[50] = [207,"The database column being accessed is invalid."];
	aDEFAULT_ERRORCODES[51] = [208,"The database object being accessed is invalid."];
	aDEFAULT_ERRORCODES[52] = [515,"A NULL value cannot be inserted."];
	aDEFAULT_ERRORCODES[53] = [2627,"The value already exists. Please select another one."];
		// expands on default code 2627
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [-2627,"The User login Name you specified is already in use.  Please select another."];
		// AddNewActivity error codes (start at 2^31-1)
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [2147483647,"The parent activity ID was not found. Activity will be inserted at the top of the page."];
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [2147483646,"From AddActivityLocation: This function has not been implemented yet."];
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [2147483645,"From AddActivityLocation: RangeName returned unsupported RangeType."];
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [2147483644,"From AddActivityLocation: RangeName not found in XEGY_Range."];
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [2147483643,"Category name not found."];
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [2147483642,"Option name not found."];
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [2147483641,"Item type not found."];
		 // XEGY_AdminFunctions error codes (start at 2^30 - 1)
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [1073741823,"Error from SetRadioElementState: 1073741823 - More than one ACCEL_ElementTracking records were found.\nPlease note exactly where this occured and send that information and this message to support."];
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [1073741822,"Activity cannot be completed. Requirements not met.  Check for unanswered questions or unchecked mandatory activities."];
		aCUSTOM_ERRORCODES[aCUSTOM_ERRORCODES.length] = [1073741821,"Activity is located in more than one place and cannot be relocated."];
 
	aDEFAULT_ERRORCODES[54] = [8152,"The value is too long. Please choose a shorter value."];
    //-------------------------------------------------------------
    
    //-------------------------------------------------------------
    function DisplayError(err_code) {
      var errmsg = "";
      if (err_code == 0 || err_code == "" || typeof err_code == "undefined") {return;}
    
      //custom error handler
      for (var i = 0; i < aCUSTOM_ERRORCODES.length; i++) {
        if (aCUSTOM_ERRORCODES[i][ERRORCODE] == err_code) {
          errmsg = aCUSTOM_ERRORCODES[i][ERRORMESSAGE];
          alert(errmsg);
          return;
        }
      }
    
      //default error handle  
      for (var i = 0; i < aDEFAULT_ERRORCODES.length; i++) {
        if (aDEFAULT_ERRORCODES[i][ERRORCODE] == err_code) {
          errmsg = aDEFAULT_ERRORCODES[i][ERRORMESSAGE];
          alert(errmsg);
          return;
        }  
      }
      
      //default error message
      alert(DEFAULT_ERRORMESSAGE);
    }
    //-------------------------------------------------------------
