﻿RegMgr._instance = null;
RegMgr.GetInstance = function() 
{
    if (this._instance == null) 
    {
        this._instance = new RegMgr();
    }
    return this._instance;
}
function RegMgr()
{
    this._Form = undefined;
    this._ServerPage = undefined;
    this._RegDivTag = undefined;


    this._FormControl = new Object();
    this._RegType = undefined; ;
    
    if (RegMgr.caller != RegMgr.GetInstance)
    {
        throw new Error("There is no public constructor for RegMgr.");
    }
    RegMgr.prototype.BindFormAndPage = function(FormName,ServerPage,RegDivTag)
    {
        var junk ="me";
        this._Form = document.forms[FormName];
        this._ServerPage = ServerPage;
        this._RegDivTag = RegDivTag ;   
    }
    RegMgr.prototype.EmailUpdate = function(EID, CID)
    {
        try{
            //var junk = this._RegType;
            this.RegEvent('EMAIL:' + $F(EID) + '~COUNTRY:' + $F(CID) + '~RegType:' + this._RegType);
        }
        catch (ex) { IDESJSUtil.LogErr("EmailUpdate", ex.message); }
    }

    RegMgr.prototype.UpdateCountry = function(EID, CID) {
        try{
       // var junk = $F(ID);
            this.RegEvent('EMAIL:' + $F(EID) + '~COUNTRY:' + $F(CID) + '~RegType:' + this._RegType);
        }
        catch (ex) { IDESJSUtil.LogErr("UpdateCountry", ex.message); }
    }

    RegMgr.prototype.SubmitClick = function(CID, EID, FNID, LNID, JTID, JFID, PID, CPID, CTID, MTID, A1ID, A2ID, CTYID, STID, PCID, PW1ID) {
        var junk = $F(CID);
       
        var ProcessOK = true;
        try{
            if ($('Country').visible() && $('Country').value == '-1') {
                ProcessOK = false;
                $('CountryREQCell').innerHTML = 'Required';
            }
            else
                $('CountryREQCell').innerHTML = '';

            if ($('EmailAddress').visible() && $('EmailAddress').value == '') {
                ProcessOK = false;
                $('EmailREQCell').innerHTML = 'Required';
            }
            else
                $('EmailREQCell').innerHTML = '';

            if ($('Password1').visible() && $('Password1').value == '') {
                ProcessOK = false;
                $('Password1REQCell').innerHTML = 'Required';
            }
            else
                $('Password1REQCell').innerHTML = '';

            if ($('FirstName').visible() && $('FirstName').value == '') {
                ProcessOK = false;
                $('FirstNameREQCell').innerHTML = 'Required';
            }
            else
                $('FirstNameREQCell').innerHTML = '';

            if ($('LastName').visible() && $('LastName').value == '') {
                ProcessOK = false;
                $('LastNameREQCell').innerHTML = 'Required';
            }
            else
                $('LastNameREQCell').innerHTML = '';

            if ($('JobTitle').visible() && $('JobTitle').value == '') {
                ProcessOK = false;
                $('JobTitleREQCell').innerHTML = 'Required';
            }
            else
                $('JobTitleREQCell').innerHTML = '';

            if ($('Phone').visible() && $('Phone').value == '') {
                ProcessOK = false;
                $('PhoneREQCell').innerHTML = 'Required';
            }
            else
                $('PhoneREQCell').innerHTML = '';

            if ($('Company').visible() && $('Company').value == '') {
                ProcessOK = false;
                $('CompanyREQCell').innerHTML = 'Required';
            }
            else
                $('CompanyREQCell').innerHTML = '';

            if ($('CompanyType').visible() && $('CompanyType').value == '-1') {
                ProcessOK = false;
                $('CompanyTypeREQCell').innerHTML = 'Required';
            }
            else
                $('CompanyTypeREQCell').innerHTML = '';

            if ($('MarketType').visible() && $('MarketType').value == '-1') {
                ProcessOK = false;
                $('MarketTypeREQCell').innerHTML = 'Required';
            }
            else
                $('MarketTypeREQCell').innerHTML = '';

            if ($('JobFunction').visible() && $('JobFunction').value == '-1') {
                ProcessOK = false;
                $('JobFunctionREQCell').innerHTML = 'Required';
            }
            else
                $('JobFunctionREQCell').innerHTML = '';

            if ($('Address1').visible() && $('Address1').value == '') {
                ProcessOK = false;
                $('Address1REQCell').innerHTML = 'Required';
            }
            else
                $('Address1REQCell').innerHTML = '';

            if ($('Address2').visible() && $('Address2').value == '') {
                ProcessOK = false;
                $('Address2REQCell').innerHTML = 'Required';
            }
            else
                $('Address2REQCell').innerHTML = '';

            if ($('City').visible() && $('City').value == '') {
                ProcessOK = false;
                $('CityREQCell').innerHTML = 'Required';
            }
            else
                $('CityREQCell').innerHTML = '';

            if ($('States').visible() && $('States').value == '') {
                ProcessOK = false;
                $('StatesREQCell').innerHTML = 'Required';
            }
            else
                $('StatesREQCell').innerHTML = '';

            if ($('PostalCode').visible() && $('PostalCode').value == '') {
                ProcessOK = false;
                $('PostalCodeREQCell').innerHTML = 'Required';
            }
            else
                $('PostalCodeREQCell').innerHTML = '';

            if (ProcessOK)
            //     var junk = 'COUNTRY:' + $F(CID) + '~EMAIL:' + $F(EID) + '~FirstName:' + $F(FNID) + '~LastName:' + $F(LNID) + '~JobTitle:' + $F(JTID) + '~JobFunction:' + $F(JFID) + '~Phone:' + $F(PID) + '~Company:' + $F(CPID) + '~CompanyType:' + $F(CTID) + '~MarketType:' + $F(MTID) + '~Address1:' + $F(A1ID) + '~Address2:' + $F(A2ID) + '~City:' + $F(CTYID) + '~State:' + $F(STID) + '~PostalCode:' + $F(PCID) + '~Password1:' + $F(PW1ID)+'~RegType:' + this._RegType;
                this.SubmitEvent('COUNTRY:' + $F(CID) + '~EMAIL:' + $F(EID) + '~FirstName:' + $F(FNID) + '~LastName:' + $F(LNID) + '~JobTitle:' + $F(JTID) + '~JobFunction:' + $F(JFID) + '~Phone:' + $F(PID) + '~Company:' + $F(CPID) + '~CompanyType:' + $F(CTID) + '~MarketType:' + $F(MTID) + '~Address1:' + $F(A1ID) + '~Address2:' + $F(A2ID) + '~City:' + $F(CTYID) + '~State:' + $F(STID) + '~PostalCode:' + $F(PCID) + '~Password1:' + $F(PW1ID) + '~RegType:' + this._RegType);
        }
        catch (ex) { IDESJSUtil.LogErr("SubmitClick", ex.message); }
    }
    
    RegMgr.prototype.RegEvent = function(APRAM) {
    
        try{
            if (APRAM==undefined){APRAM = '';}
            this._Form.elements['APARAM'].value='RegEvent~'+APRAM;
            this.AJAXRequest(this.RegEventPostBack);
        }
        catch (ex) { IDESJSUtil.LogErr("RegEvent", ex.message); }
           
    }

    RegMgr.prototype.SubmitEvent = function(APRAM) {
        try{
            if (APRAM == undefined) { APRAM = ''; }
            this._Form.elements['APARAM'].value = 'SubmitEvent~' + APRAM;
            this.AJAXRequest(this.SubmitEventPostBack);
        }
        catch (ex) { IDESJSUtil.LogErr("SubmitEvent", ex.message); }
    }
    
    RegMgr.prototype.AJAXRequest = function(CallBackFunction)
    {
        new Ajax.Request(this._ServerPage, { method: 'post',  onSuccess: CallBackFunction, parameters: Form.serialize(this._Form) });
    }
    RegMgr.prototype.SubmitEventPostBack = function(transport) {
        var RTResp;
        var junk = "me";

        try {
            eval('AJAXResp = ' + transport.responseText); // } catch (ex) { alert(ex.message); }

            if (AJAXResp.RegContent != undefined) {
                //            RegMgr._instance.CheckForCRMAccount(AJAXResp.RegContent);
                //alert(AJAXResp.RegContent.IsSuccess);
                if (AJAXResp.RegContent.Email != 'Error') {

                    if (AJAXResp.RegContent.IsSuccess == "True") {
                        // transfer to final Page

                        // Need to determin What Site
                        var RegSite = "PL";
                        if (RegMgr._instance._RegType == 'FH')
                            RegSite = 'FH';

                        top.location.href = "thankyou.aspx?site=" + RegSite; //+ "&uid=" + $F('EmailAddress') + "&pwd=" + $F('Password1');

                        //                    if (RegMgr._instance._RegType != 'FH')
                        //                        top.location.href = "http://prospector.ides.com/loginpage.aspx?uid=" + $F('EmailAddress') + "&pwd=" + $F('Password1') + "&A=DOLOGIN";
                        //                    else if (RegMgr._instance._RegType == 'FH')
                        //                        top.location.href = "http://composites.ides.com/loginpage.aspx?uid=" + $F('EmailAddress') + "&pwd=" + $F('Password1') + "&A=DOLOGIN"; // Change to Firehole once Live
                        return void (0);
                    }
                    else {
                        if (AJAXResp.RegContent.IsSuccess == "False") {
                            if (AJAXResp.RegContent.IsBL == "True" || AJAXResp.RegContent.IsGL == "True") {
                                location.href = "unable.aspx";
                                return void (0);
                            }
                            else if (AJAXResp.RegContent.Corporate == 'true') {
                                location.href = "Corporate.aspx";
                                return void (0)
                            }
                            else if (AJAXResp.RegContent.HasAccount == 'true') {
                                location.href = "CurrentUser.aspx";
                                return void (0)
                            }
                            else {
                                location.href = "regerror.aspx";
                                return void (0);
                            }
                        }
                    }
                }
                else {
                    $('EmailREQCell').innerHTML = 'Incorrect Email Format';
                }
            }
        }
        catch (ex) { IDESJSUtil.LogErr("SubmitEventPostback", ex.message); }
    }
    RegMgr.prototype.RegEventPostBack = function(transport) {
        var RTResp;
        var junk = "me";
        try { eval('AJAXResp = ' + transport.responseText); //} catch (ex) { alert(ex.message); }
       // try{
            if (AJAXResp.RegContent != undefined) {
                if (AJAXResp.RegContent.Email != 'Error') {
                    RegMgr._instance.UpdateRegContent(AJAXResp.RegContent);
                    RegMgr._instance.CheckForUserAccount(AJAXResp.RegContent);
                    RegMgr._instance.CheckForCRMAccount(AJAXResp.RegContent);
                    RegMgr._instance.CheckForCorporateAccount(AJAXResp.RegContent);
                    
                    $('EmailREQCell').innerHTML = '';
                }
                else {
                    $('EmailREQCell').innerHTML = 'Incorrect Email Format';
                
                }
            }
        }
        catch (ex) { IDESJSUtil.LogErr("RegEventPostBack", ex.message); }
    }
    RegMgr.prototype.RegInitLoadPostBack = function(transport)
    {
        var RTResp;
        var junk= "me";
        try { eval('AJAXResp = ' + transport.responseText); //} catch (ex) { alert(ex.message); }
            IDESJSUtil.PopulateList('JobFunction',AJAXResp.JobFunction.Options);
            IDESJSUtil.PopulateList('MarketType',AJAXResp.MarketType.Options);
            IDESJSUtil.PopulateList('CompanyType',AJAXResp.CompanyType.Options);
            IDESJSUtil.PopulateList('States',AJAXResp.States.Options);
            IDESJSUtil.PopulateList('Country',AJAXResp.Country.Options);
            RegMgr.GetInstance()._RegType = AJAXResp.regType;
            RegMgr.GetInstance()._FormControl = AJAXResp.PageControl;
            RegMgr._instance.SetInitDisplay();
        }
        catch (ex) { IDESJSUtil.LogErr("RegInitLoadPostBack", ex.message); }
    }

    RegMgr.prototype.CheckForCRMAccount = function(RegContent) {

        var page_type;
        var password;
        try{
            password = RegContent.Password;

            if (RegContent.Company == undefined || RegContent.Company == "") {// do heavy registration
                page_type = 'heavy';
            }
            else if (RegContent.Company != "") {// Light Registration
                page_type = 'light';
            }
            else
                page_type = 'heavy';

            if (RegContent.HasCRMAccount == 'true') {

                if (password != undefined && password != '')
                    this.ControlOnOffNew('Password1', 'hide', 'light', page_type, password, this._FormControl.Password1[0].displaytext);
                    this.ControlOnOffNew('FirstName', 'hide', this._FormControl.FirstName[0].type, page_type, '', this._FormControl.FirstName[0].displaytext);
                    this.ControlOnOffNew('LastName', 'hide', this._FormControl.LastName[0].type, page_type, '', this._FormControl.LastName[0].displaytext);
                    this.ControlOnOffNew('Company', 'hide', this._FormControl.Company[0].type, page_type, RegContent.Company, this._FormControl.Company[0].displaytext);
                    this.ControlOnOffNew('JobTitle', 'hide', this._FormControl.JobTitle[0].type, page_type, '', this._FormControl.JobTitle[0].displaytext);
                    this.ControlOnOffNew('Phone', 'hide', this._FormControl.Phone[0].type, page_type, '', this._FormControl.Phone[0].displaytext);
                    this.ControlOnOffNew('CompanyType', 'hide', this._FormControl.CompanyType[0].type, page_type, RegContent.CompanyType, this._FormControl.CompanyType[0].displaytext);
                    this.ControlOnOffNew('MarketType', 'hide', this._FormControl.MarketType[0].type, page_type, RegContent.MarketType, this._FormControl.MarketType[0].displaytext);
                    this.ControlOnOffNew('JobFunction', 'hide', this._FormControl.JobFunction[0].type, page_type, null, this._FormControl.JobFunction[0].displaytext);
                    this.ControlOnOffNew('Address1', 'hide', this._FormControl.Address1[0].type, page_type, '', this._FormControl.Address1[0].displaytext);
                    this.ControlOnOffNew('Address2', 'hide', this._FormControl.Address2[0].type, page_type, '', this._FormControl.Address2[0].displaytext);
                    this.ControlOnOffNew('City', 'hide', this._FormControl.City[0].type, page_type, '', this._FormControl.City[0].displaytext);
                    this.ControlOnOffNew('States', 'hide', this._FormControl.States[0].type, page_type, null, this._FormControl.States[0].displaytext);
                    this.ControlOnOffNew('PostalCode', 'hide', this._FormControl.PostalCode[0].type, page_type, '', this._FormControl.PostalCode[0].displaytext);
                    this.ControlOnOffNew('Country', 'hide', 'light', page_type, null, this._FormControl.Country[0].displaytext);
                
            }
        }
        catch (ex) { IDESJSUtil.LogErr("CheckForCRMAccount", ex.message); }
    }
    RegMgr.prototype.CheckForUserAccount = function(RegContent) {

        try{
            if (RegContent.HasAccount == 'true') {
                location.href = "CurrentUser.aspx";
                return void (0);
            }
        }
        catch (ex) { IDESJSUtil.LogErr("CheckForUserAccount", ex.message); }        
    }
    
    RegMgr.prototype.CheckForCorporateAccount = function(RegContent) {
        try{
             if (RegContent.Corporate == 'true' ) {
                location.href = "Corporate.aspx";
                return void (0);
            }
        }
        catch (ex) { IDESJSUtil.LogErr("CheckforCorporateAccount", ex.message); }
    }

    RegMgr.prototype.UpdateRegContent = function(RegContent) {

        var page_type;
        // Do Heavy/Light form adjustment here
        try{
            if (RegContent.Company == undefined || RegContent.Company == "") {// do heavy registration
                page_type = 'heavy';
            }
            else if (RegContent.Company != "") {// Light Registration
                page_type = 'light';
            }
            else
                page_type = 'heavy';

            this.ControlOnOffNew('EmailAddress', 'show', 'light', page_type, null, this._FormControl.EmailAddress[0].displaytext);
            this.ControlOnOffNew('FirstName', this._FormControl.FirstName[0].visible, this._FormControl.FirstName[0].type, page_type, '', this._FormControl.FirstName[0].displaytext);
            this.ControlOnOffNew('LastName', this._FormControl.LastName[0].visible, this._FormControl.LastName[0].type, page_type, '', this._FormControl.LastName[0].displaytext);
            this.ControlOnOffNew('Company', this._FormControl.Company[0].visible, this._FormControl.Company[0].type, page_type, RegContent.Company, this._FormControl.Company[0].displaytext);
            this.ControlOnOffNew('JobTitle', this._FormControl.JobTitle[0].visible, this._FormControl.JobTitle[0].type, page_type, '', this._FormControl.JobTitle[0].displaytext);
            this.ControlOnOffNew('Phone', this._FormControl.Phone[0].visible, this._FormControl.Phone[0].type, page_type, '', this._FormControl.Phone[0].displaytext);
            this.ControlOnOffNew('CompanyType', this._FormControl.CompanyType[0].visible, this._FormControl.CompanyType[0].type, page_type, RegContent.CompanyType, this._FormControl.CompanyType[0].displaytext);
            this.ControlOnOffNew('MarketType', this._FormControl.MarketType[0].visible, this._FormControl.MarketType[0].type, page_type, RegContent.MarketType, this._FormControl.MarketType[0].displaytext);
            this.ControlOnOffNew('JobFunction', this._FormControl.JobFunction[0].visible, this._FormControl.JobFunction[0].type, page_type, null, this._FormControl.JobFunction[0].displaytext);
            this.ControlOnOffNew('Address1', this._FormControl.Address1[0].visible, this._FormControl.Address1[0].type, page_type, '', this._FormControl.Address1[0].displaytext);
            this.ControlOnOffNew('Address2', this._FormControl.Address2[0].visible, this._FormControl.Address2[0].type, page_type, '', this._FormControl.Address2[0].displaytext);
            this.ControlOnOffNew('City', this._FormControl.City[0].visible, this._FormControl.City[0].type, page_type, '', this._FormControl.City[0].displaytext);
            this.ControlOnOffNew('States', this._FormControl.States[0].visible, this._FormControl.States[0].type, page_type, null, this._FormControl.States[0].displaytext);
            this.ControlOnOffNew('PostalCode', this._FormControl.PostalCode[0].visible, this._FormControl.PostalCode[0].type, page_type, '', this._FormControl.PostalCode[0].displaytext);
            this.ControlOnOffNew('Country', 'show', 'light', page_type, null, this._FormControl.Country[0].displaytext);
            this.ControlOnOffNew('Password1','show', 'light', page_type, '', this._FormControl.Password1[0].displaytext);
        }
        catch (ex) { IDESJSUtil.LogErr("UpdateRegContent", ex.message); }
    }
    
    RegMgr.prototype.InitLoad = function() {   
    
       
        this._Form.elements['APARAM'].value='InitLoad';
        this.AJAXRequest(this.RegInitLoadPostBack);        
    }



    RegMgr.prototype.ControlOnOffNew = function(control, visibility, type, page_type, value, dispaly_text) {
        try{
            if (visibility == 'show' && (type == page_type || page_type == 'heavy' || page_type == null)) {

                $(control).show();
                $(control + 'Cell').innerHTML = dispaly_text;
                if (value != null) {
                    if ($(control).type == 'text')
                        $(control).value = value;
                    else if ($(control).type == 'select-one')
                        SelectItem($(control), value);
                }
            }
            else {
                $(control).hide();
                $(control + 'Cell').innerHTML = "";
                $(control + 'REQCell').innerHTML = "";
                if (value != null) {
                    if ($(control).type == 'text')
                        $(control).value = value;
                    else if ($(control).type == 'select-one')
                        SelectItem($(control), value);
                }
                else if ($(control).type == 'select-one')
                    SelectItem($(control), 'Other');
            }
        }
        catch (ex) { IDESJSUtil.LogErr("ContronOnOffNew", ex.message); }
    }


    RegMgr.prototype.SetInitDisplay = function() {
        var page_type = null;
        try{
            this.ControlOnOffNew('EmailAddress', 'show', 'light', page_type, null, this._FormControl.EmailAddress[0].displaytext);
            this.ControlOnOffNew('FirstName', this._FormControl.FirstName[0].visible, this._FormControl.FirstName[0].type, page_type, '', this._FormControl.FirstName[0].displaytext);
            this.ControlOnOffNew('LastName', this._FormControl.LastName[0].visible, this._FormControl.LastName[0].type, page_type, '', this._FormControl.LastName[0].displaytext);
            this.ControlOnOffNew('Company', this._FormControl.Company[0].visible, this._FormControl.Company[0].type, page_type,'', this._FormControl.Company[0].displaytext);
            this.ControlOnOffNew('JobTitle', this._FormControl.JobTitle[0].visible, this._FormControl.JobTitle[0].type, page_type, '', this._FormControl.JobTitle[0].displaytext);
            this.ControlOnOffNew('Phone', this._FormControl.Phone[0].visible, this._FormControl.Phone[0].type, page_type, '', this._FormControl.Phone[0].displaytext);
            this.ControlOnOffNew('CompanyType', this._FormControl.CompanyType[0].visible, this._FormControl.CompanyType[0].type, page_type, null, this._FormControl.CompanyType[0].displaytext);
            this.ControlOnOffNew('MarketType', this._FormControl.MarketType[0].visible, this._FormControl.MarketType[0].type, page_type, null, this._FormControl.MarketType[0].displaytext);
            this.ControlOnOffNew('JobFunction', this._FormControl.JobFunction[0].visible, this._FormControl.JobFunction[0].type, page_type, null, this._FormControl.JobFunction[0].displaytext);
            this.ControlOnOffNew('Address1', this._FormControl.Address1[0].visible, this._FormControl.Address1[0].type, page_type, '', this._FormControl.Address1[0].displaytext);
            this.ControlOnOffNew('Address2', this._FormControl.Address2[0].visible, this._FormControl.Address2[0].type, page_type, '', this._FormControl.Address2[0].displaytext);
            this.ControlOnOffNew('City', this._FormControl.City[0].visible, this._FormControl.City[0].type, page_type, '', this._FormControl.City[0].displaytext);
            this.ControlOnOffNew('States', this._FormControl.States[0].visible, this._FormControl.States[0].type, page_type, null, this._FormControl.States[0].displaytext);
            this.ControlOnOffNew('PostalCode', this._FormControl.PostalCode[0].visible, this._FormControl.PostalCode[0].type, page_type, '', this._FormControl.PostalCode[0].displaytext);
            this.ControlOnOffNew('Country', 'show', 'light', page_type, null, this._FormControl.Country[0].displaytext);
            this.ControlOnOffNew('Password1', 'show', 'light', page_type, '', this._FormControl.Password1[0].displaytext);
        }
        catch (ex) { IDESJSUtil.LogErr("SetInitDisplay", ex.message); }
    }
}
function SelectItem(ListBoxID, ItemName)
{
    var ListBoxElem = $(ListBoxID);
    try
    {
        for(var i=0;i<ListBoxElem.length;i++)
        {
            var ID = ListBoxElem[i].value;
            var Display = ListBoxElem[i].text;
            if(Display == ItemName){ListBoxElem.options[i].selected = true; break;}
        }
    }
    catch (ex) { IDESJSUtil.LogErr("SelectItem", ex.message); }
}
function SetBoxValue(ListBoxID, Value) {
    var ListBoxElem = $(ListBoxID);
    try {
        ListBoxElem
        
    }
    catch (ex) { IDESJSUtil.LogErr("SetBoxValue", ex.message); }
    
}


function  IDESJSUtil() {}
IDESJSUtil.PopulateList = function(ListBoxID,ObjectData)
{
    var ListBoxElem = $(ListBoxID);

    if (ListBoxElem.length > 0){ListBoxElem.length = 0;}
    try 
    {
        for (var i=0; i<ObjectData.length; i++)
        {
            var ID = ObjectData[i].Id;
            var Display = ObjectData[i].Name;
            ListBoxElem.options[i] = new Option(Display,ID);            
            if (ObjectData[i].Selected=="True") {ListBoxElem.options[i].selected = true;}
        }
    }
    catch (ex)
    {if (ListBoxElem.length > 0){ListBoxElem.length = 0;}}
}

IDESJSUtil.LogErr = function(CallFctn, MsgDtl, Msg, Severity) {
    if (CallFctn == undefined) { CallFctn = "Calling Function Not Specified"; }
    if (MsgDtl == undefined) { MsgDtl = "Undefined JS Error"; }
    if (Msg == undefined) { Msg = "JS Exception"; }
    if (Severity == undefined) { Severity = "INFO"; }
    MsgDtl = CallFctn + "\n" + MsgDtl;
    var ErrorPage = "http://services.ides.com/AJAXServices/Logging.aspx";
    var RN = Math.random();
    var QS = '?MSG=' + escape(Msg) + '&SEV=' + escape(Severity) + '&MSGDTL=' + escape(MsgDtl) + '&CK=' + RN;
    try {
        var ErrPost = new Image();
        ErrPost.src = ErrorPage + QS;
    }
    catch (ex) { }
    finally { ErrPost = null; }
}

