<cfcomponent displayname="Application"  hint="Handle the application" output="true">

<!--- Set up the application. --->
    <cfset THIS.Name = "AppCFC" />
    <cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 2, 0, 0 ) />
    <cfset THIS.SessionManagement = true />
    <cfset THIS.SetClientCookies = true />
    <cfset THIS.clientmanagement="yes">
    <cfparam name="session.display" default="">

  
    <!--- Define the page request properties. --->
    <!--- <cfsetting  requesttimeout="2000"  showdebugoutput="true"  enablecfoutputonly="false"/> --->
    <cffunction  name="OnApplicationStart"   access="public" returntype="boolean"  output="false"  hint="Fires when the application is first created.">
         <!--- Return out. ---> 
             <cfset Application.Version = "7.0.0">
            <cfset Application.powerpath_version = "11.20.2009">
            <cfset Application.DataSrc = "hhapowerpath" />
            <cfset Application.dbPatientFiles = "hhapatientfiles" />
            <cfset Application.NoEmptyDates = 0>
            <cfset application.debug=0>
            <cfset Application.datatype = ".dat">
            <cfset Application.enckey ="54kczhzgHTj4a8n+SRZPyg==" />
            <cfset Application.todaydate = #DateFormat(now(),"yyyy-mm-dd")# />
            <cfif CGI.SERVER_NAME EQ "127.0.0.1" || CGI.SERVER_NAME EQ "localhost">
                <cfset Application.DEV = true />
                <cfset application.downloadpath="http://127.0.0.1/">
                <cfset application.webdatapath="#application.downloadpath#/datafiles/">
                <cfset application.datapath="/var/www/datafiles/">
                <cfset application.telephonypath="/var/www/exportdata/">
                <cfset application.secure="http://127.0.0.1/">
                <cfset application.siteURL="http://127.0.0.1/">
                <cfset application.rootfolder="http://127.0.0.1/">
                <cfset Application.ServerName = "New Powerpath ">
             <cfelseif CGI.SERVER_NAME EQ "52.23.186.30" || CGI.SERVER_NAME EQ "dev.myhomecarebiz.com">
                <cfset Application.DEV = true />
                <cfset application.downloadpath="http://dev.myhomecarebiz.com/">
                <cfset application.webdatapath="#application.downloadpath#/datafiles/">
                <cfset application.datapath="/var/www/datafiles/">
                <cfset application.telephonypath="/var/www/exportdata/">
                <cfset application.secure="http://dev.myhomecarebiz.com/">
                <cfset application.siteURL="http://dev.myhomecarebiz.com/">
                <cfset application.rootfolder="http://dev.myhomecarebiz.com/">
                <cfset Application.ServerName = "New Powerpath ">

            <cfelseif CGI.SERVER_NAME EQ "3.217.173.222">
                <cfset Application.DEV = true />
                <cfset application.downloadpath="http://3.217.173.222/">
                <cfset application.webdatapath="#application.downloadpath#/datafiles/">
                <cfset application.datapath="/var/www/datafiles/">
                <cfset application.telephonypath="/var/www/exportdata/">
                <cfset application.secure="http://3.217.173.222/">
                <cfset application.siteURL="http://3.217.173.222/">
                <cfset application.rootfolder="http://3.217.173.222/">
                <cfset Application.ServerName = "New Powerpath ">

            <!---Amazon Live Server--->
            <cfelse>
                <cfset Application.DEV = false />
                <cfset application.downloadpath="https://secure.myhomecarebiz.com">
                <cfset application.webdatapath="#application.downloadpath#/datafiles/">
                <cfset application.datapath="/var/www/datafiles/">
                <cfset application.telephonypath="/var/www/exportdata/">
                <cfset application.secure="https://secure.myhomecarebiz.com/">
                <cfset application.siteURL="https://secure.myhomecarebiz.com/">
                <cfset application.rootfolder="https://secure.myhomecarebiz.com/">
                <cfset Application.ServerName = "#cgi.server_NAME#">
                <cfset Application.GoogleMapsAPIKey = "AIzaSyAXWgATrPBtb7em-iICftXhJT-e6a4BroQ"/>
                   <!---<cfinclude template="/Application_error_settings.cfm" />--->
            </cfif>
            <cfswitch expression="#CGI.SERVER_NAME#">
                <!---Amazon Dev Server--->
                <cfcase value="54.235.249.158">
                    <cfset Application.DataSrc = "hhapowerpath">
                </cfcase>
                <cfcase value="secure.myhomecarebiz.com">
                    <cfset Application.DataSrc = "hhapowerpath">
                </cfcase>
                <cfcase value="mhcblive.ctmzbiqfwjd0.us-east-1.rds.amazonaws.com">
                    <cfset Application.DataSrc = "hhapowerpath">
                </cfcase>
                <cfdefaultcase>
                    <cfset Application.DataSrc = "hhapowerpath">
                </cfdefaultcase>
            </cfswitch>
        <cfreturn true />
    </cffunction>


    <cffunction name="OnSessionStart"  access="public" returntype="void"  output="false"   hint="Fires when the session is first created.">
         <!--- Return out. ---> 
        <cfreturn />
    </cffunction>


    <cffunction  name="OnRequestStart"   access="public" returntype="boolean" output="false" hint="Fires at first part of page processing.">
       <!--- Define arguments. --->
      <cfargument  name="TargetPage" type="string" required="true"  />
         <cfset request.send_errors_to = "velmurugan@myhomecarebiz.com,velmurugan_g@outlook.com"> 
     <!---  <cfset request.send_errors_to = "velmurugan_g@outlook.com,velmurugan@myhomecarebiz.com"> --->
          <cfset request.from = 'error@myhomecarebiz.com' />
          <cfset Request.prefix_db_lookup = "hhapowerpath" />
        <cfset Request.prefix_db_agency = "prefix_db_agency_invalid" />
         <cfset request.todaydate = #DateFormat(now(),"yyyy-mm-dd")# />
        <cfif isDefined("URL.cron") and URL.cron eq 1>
            <cfset Request.Agency_ID = true />
        </cfif>
        
            <cfif isDefined("FORM.prefix_db_agency_id")>
                <cfif isNumeric(FORM.prefix_db_agency_id)>
                    <cfset Request.prefix_db_agency = "agency_"&FORM.prefix_db_agency_id />
                    <cfset Request.Agency_ID = FORM.prefix_db_agency_id />
                </cfif>
            
                <!--- delete agency_id to resolve conflict with cfinsert/cfupdate --->
                <cfset rc = StructDelete(FORM, "prefix_db_agency_id", "True")>
            <cfelseif isDefined("URL.prefix_db_agency_id") or isDefined("URL.passthrough_data")>
                            <cfif isDefined("URL.passthrough_data") and URL.passthrough_data neq "">
                                <cfset ptd = listToArray(#URL.passthrough_data#, "||", false, true) />
                    
                            <cfloop from="1" to="#arrayLen(ptd)#" index="i">
                                <cfset key = gettoken(ptd[i],1,"|") />
                                <cfset value = gettoken(ptd[i],2,"|") />
                    
                                <cfif key eq "prefix_db_agency_id">
                                    <cfset Request.prefix_db_agency = "agency_"&value />
                                    <cfset Request.Agency_ID = value />
                                    <cfset Request.agency_found = true />
                                </cfif>
                            </cfloop>
                        <cfelse>
                            <cfif isNumeric(URL.prefix_db_agency_id)>
                                <cfquery name="get_Agency" datasource='#Application.DataSrc#'>
                                    SELECT agency_id FROM Agency WHERE (agency_id = #URL.prefix_db_agency_id# or agency_login = #URL.prefix_db_agency_id#) limit 1
                                </cfquery>
                    
                                <cfif get_Agency.RecordCount gt 0>
                                    <cfset Request.agency_found = true />
                    
                                    <cfquery name="check_db" datasource='#Application.DataSrc#'>
                                        SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'agency_#get_Agency.agency_id#'
                                    </cfquery>
                    
                                    <cfif check_db.RecordCount gt 0>
                                        <cfset Request.prefix_db_agency = "agency_"&get_Agency.agency_id />
                                        <cfset Request.Agency_ID = get_Agency.agency_id />
                                    </cfif>
                                </cfif>
                            </cfif>
                        </cfif>
            <cfelseif isDefined("Session.Super_AgencyId") and isDefined("FORM.Super_AgencyId")>
                <cfset Session.Super_AgencyId = FORM.Super_AgencyId />
            
                <cfset Request.prefix_db_agency = "agency_"&FORM.Super_AgencyId />
                <cfset Request.Agency_ID = FORM.Super_AgencyId />
            <cfelseif isDefined("session.Super_AgencyId")>
                <cfset Request.prefix_db_agency = "agency_"&session.Super_AgencyId />
                <cfset Request.Agency_ID = session.Super_AgencyId />
            <cfelseif isDefined("session.AgencyId")>
                <cfset Request.prefix_db_agency = "agency_"&session.AgencyId />
                <cfset Request.Agency_ID = session.AgencyId />
            </cfif>
            
            <cfif Request.prefix_db_agency eq 'agency_455'>
                <cfset table_files = Request.prefix_db_lookup&'.files_old' />
            <cfelse>
                <cfset table_files = Request.prefix_db_agency&'.files' /> 
            </cfif>
          <cfif isDefined("session.AgencyId")>
            <cfquery  name='getTimeZone' datasource='#Application.DataSrc#'>
                SELECT *, '' as CODING_WIZARD   FROM #Request.prefix_db_lookup#.Agency WHERE Agency_Id = '#session.AgencyId#'
            </cfquery>
            <cfif isdefined("Session.Username")>
                <cfquery  name='getuseragency' datasource='#Application.DataSrc#'>
                    SELECT Agency.*,pEmployee.Skill_1,pEmployee.Skill_2,pEmployee.Skill_3  FROM #Request.prefix_db_lookup#.pEmployee
                    JOIN #Request.prefix_db_lookup#.Agency  ON Agency.Agency_ID = pEmployee.Loc_ID
                    WHERE pEmployee.Username = '#Session.Username#'
                    AND pEmployee.status = 0 AND Agency.status = 'active'
                </cfquery>
            </cfif>

                <cfset myTime = #now()#>
                 <cfif getTimeZone.TimeZone EQ 'CST'>
                    <cfset myTime = #TimeFormat(DateAdd('h', -1, myTime), 'HH:mm:ss')#>
                <cfelseif getTimeZone.TimeZone EQ 'MST'>
                    <cfset myTime = #TimeFormat(DateAdd('h', -2, myTime), 'HH:mm:ss')#>
                <cfelseif  getTimeZone.TimeZone EQ 'PST'>
                    <cfset myTime = #TimeFormat(DateAdd('h', -3, myTime), 'HH:mm:ss')#>
                <cfelseif  getTimeZone.TimeZone EQ 'AKST'>
                    <cfset myTime = #TimeFormat(DateAdd('h', -4, myTime), 'HH:mm:ss')#>
                <cfelseif  getTimeZone.TimeZone EQ 'HST'>
                    <cfset myTime = #TimeFormat(DateAdd('h', -7, myTime), 'HH:mm:ss')#>
                <cfelse>
                    <cfset myTime = #TimeFormat(myTime, 'HH:mm:ss')#>
                </cfif>
               <cfset myDateTime = DateFormat(Now(), 'yyyy-mm-dd') & " " & myTime />
               <cfset Request.my_Time = DateFormat(Now(), 'yyyy-mm-dd') & " " & myTime />
               <cfset application.TimeZone = getTimeZone.TimeZone />
         </cfif>
        <!--- Return out. --->
        <cfreturn true />
    </cffunction>


    <cffunction name="OnRequest"  access="public"  returntype="void" output="true" hint="Fires after pre page processing is complete.">
        <!--- Define arguments. --->
        <cfargument name="TargetPage"  type="string"  required="true"  />
        <!--- Include the requested page. --->
        <cfinclude template="#ARGUMENTS.TargetPage#" />
        <cfif not findNoCase("betterrx_test.cfm", ARGUMENTS.TargetPage)>
            <cfinclude template="/Application_common.cfm" />
        </cfif>
        <!--- Return out. --->
        <cfreturn />
    </cffunction>


    <cffunction   name="OnRequestEnd"  access="public"  returntype="void"  output="true"   hint="Fires after the page processing is complete.">
           <!--- Return out. --->
        <cfreturn />
    </cffunction>


    <cffunction name="OnSessionEnd"  access="public"  returntype="void"  output="false" hint="Fires when the session is terminated.">

        <!--- Define arguments. --->
        <cfargument   name="SessionScope" type="struct"  required="true" />
        <cfargument name="ApplicationScope"  type="struct" required="false"   default="#StructNew()#" />
       <!--- Return out. --->
        <cfreturn />
    </cffunction>


    <cffunction  name="OnApplicationEnd" access="public" returntype="void"output="false"hint="Fires when the application is terminated.">

        <!--- Define arguments. --->
        <cfargument  name="ApplicationScope" type="struct" required="false"  default="#StructNew()#"/>

        <!--- Return out. --->
        <cfreturn />
    </cffunction>


    <cffunction   name="OnError"  access="public"    returntype="void"  output="true"  hint="Fires when an exception occures that is not caught by a try/catch.">

        <!--- Define arguments. --->
        <cfargument  name="Exception" type="any" required="true" />
        <cfargument name="EventName"   type="string"  required="false"   default=""  />
       <!--- <cfinclude template="Application_error_settings.cfm" />--->
       <cfif CGI.REMOTE_ADDR EQ '121.200.49.65'><cfdump var="#Arguments.Exception#"><cfabort></cfif>
        <!--- Log all errors. ---> 
        <cflog file="#This.Name#" type="error"  text="Event Name: #Arguments.Eventname#" > 
        <cflog file="#This.Name#" type="error"  text="Message: #Arguments.Exception.message#"> 
        <!---<cflog file="#This.Name#" type="error"  text="Root Cause Message: #Arguments.Exception.rootcause.message#"> ---><cfdump var="#Arguments.Exception#">
        <!--- Display an error message if there is a page context. ---> 
        <cfif CGI.REMOTE_ADDR EQ '121.200.49.65' OR session.display EQ 'Melissa cott'><cfdump var="#Arguments.Exception#"><cfabort></cfif>
        <cfif NOT (Arguments.EventName IS "onSessionEnd") OR  (Arguments.EventName IS "onApplicationEnd")> 
                 <div class="row">
                        <style>
                             @color-primary: ##30A9DE;
                            @color-secondary: ##30A9DE;
                            @color-tertiary: ##30A9DE;
                            @color-primary-light: ##6AAFE6;
                            @color-primary-dark: ##8EC0E4;
                            @Distance: 1000px;
                          
                            
                            .Container {
                              text-align: center;
                              position: relative;
                            }
                            
                            .MainTitle {
                              display: block;
                              font-size: 2rem;
                              font-weight: lighter;
                              text-align: center;
                            }
                            
                            .MainDescription {
                              max-width: 50%;
                              font-size: 1.2rem;
                              font-weight: lighter;
                            }
                            
                            .MainGraphic {
                              position: relative;
                            }
                            
                            .Cog {
                              width: 10rem;
                              height: 10rem;
                              fill: @color-primary-light;
                              transition: easeInOutQuint();
                              animation: CogAnimation 5s infinite;
                            }
                            
                            .Spanner {
                              position: absolute;
                              transform: rotate(20deg);
                              top: 10%;
                              /*left: 20%;*/
                              width: 10rem;
                              height: 10rem;
                              fill: @color-primary-dark;
                              animation: SpannerAnimation 4s infinite;  
                            }
                            
                            .Hummingbird{
                              position: absolute;
                              width: 3rem;
                              height: 3rem;
                              fill: @color-primary;
                              left: 50%;
                              top: 50%;
                              transform: translate(-50%,-50%);  
                            }
                            
                            @keyframes CogAnimation {
                                0%   {transform: rotate(0deg);}
                                100% {transform: rotate(360deg);}
                            }
                            
                            @keyframes SpannerAnimation {
                                0%   {
                                  transform: 
                                    translate3d(20px, 20px,1px)
                                    rotate(0deg);
                                }
                                10% {
                                  transform: 
                                    translate3d(-@Distance, @Distance, 1px)           
                                    rotate(180deg);
                                }
                                15% {
                                  transform: 
                                    translate3d(-@Distance, @Distance, 1px)           
                                    rotate(360deg);
                                }    
                                20% {
                                  transform: 
                                    translate3d(@Distance, -@Distance, 1px)           
                                    rotate(180deg);
                                }
                                30% {
                                  transform: 
                                    translate3d(-@Distance, @Distance, 1px)           
                                    rotate(360deg);
                                }  
                                40% {
                                  transform: 
                                    translate3d(@Distance, -@Distance, 1px)           
                                    rotate(360deg);
                                }
                                50% {
                                  transform: 
                                    translate3d(-@Distance, @Distance, 1px)           
                                    rotate(180deg);
                                }    
                                100% {
                                  transform: 
                                    translate3d(0, 0px, 0px)           
                                    rotate(360deg);
                                }  
                            }
                            
                        </style>
                        <div class="Container">
                        
                            <div class="MainGraphic">
                                <svg class="Cog" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M29.18 19.07c-1.678-2.908-.668-6.634 2.256-8.328L28.29 5.295c-.897.527-1.942.83-3.057.83-3.36 0-6.085-2.743-6.085-6.126h-6.29c.01 1.043-.25 2.102-.81 3.07-1.68 2.907-5.41 3.896-8.34 2.21L.566 10.727c.905.515 1.69 1.268 2.246 2.234 1.677 2.904.673 6.624-2.24 8.32l3.145 5.447c.895-.522 1.935-.82 3.044-.82 3.35 0 6.066 2.725 6.083 6.092h6.29c-.004-1.035.258-2.08.81-3.04 1.676-2.902 5.4-3.893 8.325-2.218l3.145-5.447c-.9-.515-1.678-1.266-2.232-2.226zM16 22.48c-3.578 0-6.48-2.902-6.48-6.48S12.423 9.52 16 9.52c3.578 0 6.48 2.902 6.48 6.48s-2.902 6.48-6.48 6.48z" /></svg>
                            </div>
                            <svg class="Spanner" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
                                <path d="M20.285 7.12c-.05-.17-.184-.3-.354-.345-.17-.047-.35.003-.476.126L16.838 9.46l-1.914-.383-.38-1.907 2.644-2.585c.126-.123.178-.303.137-.474s-.168-.31-.336-.362c-.532-.166-1.02-.248-1.49-.248-2.757 0-5 2.243-5 5 0 .323.038.65.118 1.01-.562.463-1.096.862-1.7 1.314-.866.646-1.846 1.377-3.183 2.506C4.95 14.016 4.5 14.99 4.5 16c0 1.93 1.57 3.5 3.5 3.5 1.02 0 1.993-.456 2.662-1.25 1.15-1.347 1.89-2.336 2.544-3.21.442-.59.832-1.11 1.283-1.66.36.082.687.12 1.01.12 2.757 0 5-2.243 5-5 0-.437-.068-.875-.215-1.38zM8 17c-.553 0-1-.447-1-1s.447-1 1-1 1 .447 1 1-.447 1-1 1z" />
                            </svg>
                            <h1 class="MainTitle" style="font-size:2.6rem; font-weight:bold;">Oops! Something went wrong. Sorry!!</h1>
                            <p class="Main Description" style="font-size:1.5rem; font-weight:bold;">
                             Technical problems are preventing the server from displaying this page. <br/> A detailed message is being sent to the site administrator regarding this problem and We're Working on it and we'll get it fixed as soons as we can.<br/>
                            <a href="javascript:history.back();"> Go Back</a> <br/> </p>
                        </div>
                        <script>
                            // scale on resize
                            function fontResize() {
                                var resolution = 1440;
                                var font = 10;
                    
                                var width = $(window).width();
                    
                                var newFont = font * (width / resolution);
                                $("html").css("font-size", newFont);
                            }
                    
                            $(document).ready(function () {
                                fontResize();
                                $(window).bind("resize", function () {
                                    fontResize();
                                });
                            });
                    
                        </script>
                        <cfparam name="Application.EmailCounter" default= 0 />
                        <cfif Application.EmailCounter lt 500>
                            <cfset Application.EmailCounter = Application.EmailCounter +1 />
                        </cfif>
                        <cftry>
                           <cfif isdefined('Arguments.Exception.RootCause.TagContext')>
                                             <cfmail to="#request.send_errors_to#" from="error@myhomecarebiz.com" subject="#Application.ServerName#  Error: #Arguments.Exception.RootCause.TagContext[1].TEMPLATE#" type="html">
                                    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
                                        <p><b>An error occurred on the website.</b></p>

                                        <cfif Request.prefix_db_agency eq "prefix_db_agency_invalid">
                                            <h2>Prefix Error: Prefix Was  Not Supplied</h2>
                                        <cfelseif not isDefined("Request.Agency_ID")>
                                            <h2>Prefix Error: Invalid Prefix Supplied</h2>
                                        </cfif>

                                        <table align=left>
                                            <tr>
                                                <td nowrap valign=top><b>Error Date/Time</b></td>
                                                <td>#DateFormat(now(),"mm/dd/yyyy")# #TimeFormat(now(),"hh:mm:ss")#</td>
                                            </tr>
                                            <tr>
                                                <td nowrap valign=top><b>Template</b></td>
                                                <td>#Arguments.Exception.RootCause.TagContext[1].TEMPLATE#</td>
                                            </tr>
                                            <tr>
                                                <td nowrap valign=top><b>Error Information</b></td>
                                                <td><cfif Arguments.Exception.Cause.Detail neq ''>#Arguments.Exception.Cause.Detail#<cfelse>#Arguments.Exception.Cause.Message#</cfif></td>
                                            </tr>
                                            <cfif structKeyExists("#Arguments.Exception.RootCause.TagContext[1]#","RAW_TRACE")>
                                             <tr>
                                                <td nowrap valign=top><b>Error Line</b></td>
                                                <td> #Arguments.Exception.RootCause.TagContext[1].RAW_TRACE#</td>
                                            </tr>
                                            </cfif>
                                            <tr>
                                            <tr>
                                                <td nowrap valign=top><b>URL Parameters</b></td>
                                                <td>#Arguments.Exception.RootCause.TagContext[1].TEMPLATE#</td>
                                            </tr>
                                           <tr>
                                                <td nowrap valign=top colspan=2><hr></td>
                                            </tr>

                                            <cfif isDefined("session.agencyname")>
                                                <tr>
                                                    <td nowrap valign=top><b>Agency Login</b></td>
                                                    <td>#session.agencylogin#</td>
                                                </tr>
                                                <tr>
                                                    <td nowrap valign=top><b>Agency Name</b></td>
                                                    <td>#session.agencyname#</td>
                                                </tr>
                                                <tr>
                                                    <td nowrap valign=top><b>Agency ID</b></td>
                                                    <td>#session.agencyid#</td>
                                                </tr>
                                                <tr>
                                                    <td nowrap valign=top><b>Display Name</b></td>
                                                    <td>#session.display#</td>
                                                </tr>
                                                <tr>
                                                    <td nowrap valign=top><b>User ID</b></td>
                                                    <td>#Session.EmployeeID#</td>
                                                </tr>
                                                <tr>
                                                    <td nowrap valign=top><b>User Name</b></td>
                                                    <td>#session.username#</td>
                                                </tr>
                                            </cfif>

                                            <tr>
                                                <td nowrap valign=top colspan=2><hr></td>
                                            </tr>
                                            <tr>
                                                <td nowrap valign=top><b>Server</b></td>
                                                <td>#CGI.SERVER_NAME#</td>
                                            </tr>
                                            <tr>
                                                <td nowrap valign=top><b>DSN</b></td>
                                                <td>#Application.DataSrc#</td>
                                            </tr>
                                            <tr>
                                                <td nowrap valign=top colspan=2><hr></td>
                                            </tr>
                                            <tr>
                                                <td nowrap valign=top colspan=2>
                                                    <b>Form Variables:</b><br />
                                                    <cfdump var="#FORM#"><br>

                                                    <b>URL Variables:</b><br />
                                                    <cfdump var="#URL#"><br>

                                                    <b>Request Variables:</b><br />
                                                    <cfdump var="#Request#"><br>

                                                    <b>Session Variables:</b><br />
                                                    <cfdump var="#Session#"><br>
                                                </td>
                                            </tr>
                                        </table>
                                    </font>
                                </cfmail>
                            <cfelse>
                                  <cfmail to= "velmurugan_g@outlook.com" from="error@myhomecarebiz.com" subject="#Application.ServerName# Error:" type="html">
                                  Please see below error and fix it <br>
                                  <cfdump var="#Arguments.EventName#">
                                      <cfdump var ="#Arguments.Exception#">
                                          <td nowrap valign=top colspan=2>
                                        <b>Form Variables:</b><br />
                                        <cfdump var="#FORM#"><br>

                                        <b>URL Variables:</b><br />
                                        <cfdump var="#URL#"><br>

                                        <b>Request Variables:</b><br />
                                        <cfdump var="#Request#"><br>

                                        <b>Session Variables:</b><br />
                                        <cfdump var="#Session#"><br>
                                    </td>
                                </cfmail>
                            </cfif>
                             <cfcatch>
                               <cfmail to= "velmurugan@myhomecarebiz.com,velmurugan_g@outlook.com" from="error@myhomecarebiz.com" subject="#Application.ServerName# Error:" type="html">
                              Please see below error and fix it <br>
                                  <cfdump var="#Arguments.EventName#">
                                  <cfdump var ="#Arguments.Exception#">
                                      <td nowrap valign=top colspan=2>
                                        <b>Form Variables:</b><br />
                                        <cfdump var="#FORM#"><br>

                                        <b>URL Variables:</b><br />
                                        <cfdump var="#URL#"><br>

                                        <b>Request Variables:</b><br />
                                        <cfdump var="#Request#"><br>

                                        <b>Session Variables:</b><br />
                                        <cfdump var="#Session#"><br>
                                    </td>
                            </cfmail>
                            </cfcatch>
                         </cftry>
                     
                    </div>
                
        </cfif> 
        <!--- Return out. --->
        <cfreturn />
    </cffunction>
    
</cfcomponent>