Index: cprs/branches/tmg-cprs/CPRS-Chart/Accessibility_TLB.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/Accessibility_TLB.pas	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/Accessibility_TLB.pas	(revision 809)
@@ -13,5 +13,5 @@
 
 // PASTLWTR : 1.2
-// File generated on 6/16/2010 3:23:34 PM from Type Library described below.
+// File generated on 6/21/2010 2:19:10 PM from Type Library described below.
 
 // ************************************************************************  //
Index: cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dof
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dof	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dof	(revision 809)
@@ -101,5 +101,5 @@
 UsePackages=0
 [Parameters]
-RunParams=CCOW=disable s=s0.sequencemanagers.com p=53110
+RunParams=CCOW=disable s=192.168.3.99 p=9260
 HostApplication=
 Launcher=
@@ -174,9 +174,10 @@
 Item2=C:\Vista\cprs\OR_3_215V26_69\CPRS-Chart\DCU
 [HistoryLists\hlOutputDirectorry]
-Count=4
+Count=5
 Item0=P:\vista\tmg-cprs
-Item1=P:\vista\tmg-cprs\cache
-Item2=C:\Vista\cprs\OR_3_270V26_69\CPRS-Chart
-Item3=C:\Vista\cprs\OR_3_215V26_69\CPRS-Chart
+Item1=C:\Documents and Settings\e.hagood\My Documents\CPRSChart
+Item2=P:\vista\tmg-cprs\cache
+Item3=C:\Vista\cprs\OR_3_270V26_69\CPRS-Chart
+Item4=C:\Vista\cprs\OR_3_215V26_69\CPRS-Chart
 [HistoryLists\hlBPLOutput]
 Count=2
Index: cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dpr
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dpr	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dpr	(revision 809)
@@ -332,5 +332,6 @@
   uLogic in 'TMG_Extra\uLogic.pas',
   fImagePickPDF in 'TMG_Extra\fImagePickPDF.pas' {frmImagePickPDF},
-  fImagePickExisting in 'TMG_Extra\fImagePickExisting.pas' {frmImagePickExisting};
+  fImagePickExisting in 'TMG_Extra\fImagePickExisting.pas' {frmImagePickExisting},
+  fPtDocSearch in 'TMG_Extra\fPtDocSearch.pas' {frmPtDocSearch};
 
 {$R *.TLB}
@@ -356,7 +357,8 @@
     Application.CreateForm(TdmodShared, dmodShared);
   Application.CreateForm(TfrmFrame, frmFrame);
+  Application.CreateForm(TfrmPtDocSearch, frmPtDocSearch);
   //kt <--- frmImages etc created here
-    Application.CreateForm(TfrmPtLabelPrint, frmPtLabelPrint);
     if frmframe.TMGAbort = False then begin   //kt 3/25/09
+      Application.CreateForm(TfrmPtLabelPrint, frmPtLabelPrint);
       Application.CreateForm(TfrmSearchStop, frmSearchStop);
       Application.CreateForm(TUploadForm, UploadForm);
Index: cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dsk
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dsk	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dsk	(revision 809)
@@ -1,48 +1,70 @@
 [Closed Files]
-File_0=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\BA\UBACore.pas',0,1,417,50,420,0,0
-File_1=SourceModule,'c:\program files\borland\delphi7\source\vcl\Graphics.pas',0,1,3762,1,3769,0,0
-File_2=SourceModule,'c:\program files\borland\delphi7\source\rtl\common\classes.pas',0,1,5113,1,5120,0,0
-File_3=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fImagePickPDF.pas',0,1,90,1,98,0,0
-File_4=SourceModule,'c:\program files\borland\delphi7\source\vcl\Forms.pas',0,1,2657,1,2664,0,0
-File_5=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fImagePickExisting.pas',0,1,141,1,148,0,0
-File_6=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\rHTMLTools.pas',0,1,631,12,638,0,0
-File_7=SourceModule,'c:\program files\borland\delphi7\source\rtl\Sys\system.pas',0,1,8385,1,8394,0,0
-File_8=SourceModule,'C:\PROGRA~1\VISTA\BDK32\Source\Wsockc.pas',0,1,1472,1,1479,0,0
+File_0=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtQuery.pas',0,1,1,28,200,1,0
+File_1=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\Encounter\rPCE.pas',0,1,1335,7,1345,0,0
+File_2=SourceModule,'P:\Vista\tmg-cprs\CPRS-Lib\ORNet.pas',0,1,1,14,15,0,0
+File_3=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtAdd.pas',0,1,474,22,481,0,0
+File_4=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fImagePickExisting.pas',0,1,168,50,173,1,0
+File_5=SourceModule,'c:\program files\borland\delphi7\source\rtl\Sys\sysutils.pas',0,1,16059,17,16068,0,0
+File_6=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\fNotes.dfm',0,1,1,1,1,0,0
+File_7=SourceModule,'c:\program files\borland\delphi7\source\rtl\common\Registry.pas',0,1,601,25,606,0,0
+File_8=SourceModule,'c:\program files\borland\delphi7\source\rtl\Sys\system.pas',0,1,11791,1,11801,0,0
 
 [Modules]
-Module0=P:\Vista\tmg-cprs\CPRS-Lib\ORNet.pas
-Module1=P:\vista\tmg-cprs\CPRS-Chart\rCore.pas
-Module2=c:\program files\borland\delphi7\source\rtl\Sys\sysutils.pas
-Module3=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\uLogic.pas
-Module4=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\SubfilesU.pas
-Module5=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\SearchAnimationU.pas
-Module6=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\fWebTab.pas
-Module7=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\fPtAdd.pas
-Module8=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\frmSearchResults.pas
-Module9=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtQuery.pas
-Module10=P:\vista\tmg-cprs\CPRS-Chart\fPtAdd.pas
-Module11=P:\vista\tmg-cprs\CPRS-Chart\fImages.pas
-Module12=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtAdd.pas
-Module13=P:\vista\tmg-cprs\CPRS-Chart\UploadImages.pas
-Module14=P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas
-Module15=P:\vista\tmg-cprs\CPRS-Chart\Options\rOptions.pas
-Module16=P:\vista\tmg-cprs\CPRS-Chart\fPtSel.pas
-Module17=P:\vista\tmg-cprs\CPRS-Chart\fFrame.pas
-Module18=P:\vista\tmg-cprs\CPRS-Chart\fSplash.pas
-Count=19
+Module0=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDocSearch.pas
+Module1=c:\program files\borland\delphi7\source\vcl\ExtCtrls.pas
+Module2=P:\Vista\tmg-cprs\CPRS-Lib\ORCtrls.pas
+Module3=c:\program files\borland\delphi7\source\vcl\StdCtrls.pas
+Module4=c:\program files\borland\delphi7\source\vcl\Controls.pas
+Module5=C:\PROGRA~1\VISTA\BDK32\Source\Wsockc.pas
+Module6=P:\vista\tmg-cprs\CPRS-Chart\fPtSel.pas
+Module7=P:\vista\tmg-cprs\CPRS-Chart\fPtAdd.pas
+Module8=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\uLogic.pas
+Module9=P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas
+Module10=P:\vista\tmg-cprs\CPRS-Chart\CPRSChart.dpr
+Module11=P:\vista\tmg-cprs\CPRS-Chart\rHTMLTools.pas
+Module12=P:\vista\tmg-cprs\CPRS-Chart\UploadImages.pas
+Module13=P:\vista\tmg-cprs\CPRS-Chart\uCore.pas
+Module14=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\fPtAdd.pas
+Module15=P:\vista\tmg-cprs\CPRS-Chart\fImages.pas
+Count=16
 EditWindowCount=1
 TypeLibWindowCount=1
 
-[P:\Vista\tmg-cprs\CPRS-Lib\ORNet.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\rCore.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[c:\program files\borland\delphi7\source\rtl\Sys\sysutils.pas]
+[P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDocSearch.pas]
+ModuleType=SourceModule
+FormState=1
+FormOnTop=0
+
+[c:\program files\borland\delphi7\source\vcl\ExtCtrls.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[P:\Vista\tmg-cprs\CPRS-Lib\ORCtrls.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[c:\program files\borland\delphi7\source\vcl\StdCtrls.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[c:\program files\borland\delphi7\source\vcl\Controls.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[C:\PROGRA~1\VISTA\BDK32\Source\Wsockc.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[P:\vista\tmg-cprs\CPRS-Chart\fPtSel.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[P:\vista\tmg-cprs\CPRS-Chart\fPtAdd.pas]
 ModuleType=SourceModule
 FormState=0
@@ -54,15 +76,25 @@
 FormOnTop=0
 
-[P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\SubfilesU.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\SearchAnimationU.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\fWebTab.pas]
+[P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas]
+ModuleType=SourceModule
+FormState=1
+FormOnTop=0
+
+[P:\vista\tmg-cprs\CPRS-Chart\CPRSChart.dpr]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[P:\vista\tmg-cprs\CPRS-Chart\rHTMLTools.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[P:\vista\tmg-cprs\CPRS-Chart\UploadImages.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[P:\vista\tmg-cprs\CPRS-Chart\uCore.pas]
 ModuleType=SourceModule
 FormState=0
@@ -74,19 +106,4 @@
 FormOnTop=0
 
-[P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\frmSearchResults.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtQuery.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\fPtAdd.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
 [P:\vista\tmg-cprs\CPRS-Chart\fImages.pas]
 ModuleType=SourceModule
@@ -94,47 +111,8 @@
 FormOnTop=0
 
-[P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtAdd.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\UploadImages.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\Options\rOptions.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\fPtSel.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=1
-
-[P:\vista\tmg-cprs\CPRS-Chart\fFrame.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\fSplash.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
 [C:\Program Files\Borland\Delphi7\Projects\ProjectGroup1.bpg]
 FormState=0
 FormOnTop=0
 
-[P:\vista\tmg-cprs\CPRS-Chart\CPRSChart.dpr]
-FormState=0
-FormOnTop=0
-
 [P:\vista\tmg-cprs\CPRS-Chart\CPRSChart.tlb]
 FormState=0
@@ -150,6 +128,6 @@
 
 [EditWindow0]
-ViewCount=19
-CurrentView=10
+ViewCount=16
+CurrentView=7
 View0=0
 View1=1
@@ -168,7 +146,4 @@
 View14=14
 View15=15
-View16=16
-View17=17
-View18=18
 CodeExplorer=CodeExplorer@EditWindow0
 MessageView=MessageView@EditWindow0
@@ -176,25 +151,25 @@
 Visible=1
 State=0
-Left=275
-Top=119
-Width=716
-Height=615
+Left=281
+Top=157
+Width=818
+Height=609
 MaxLeft=-4
-MaxTop=-4
-ClientWidth=708
-ClientHeight=581
+MaxTop=108
+ClientWidth=810
+ClientHeight=575
 LeftPanelSize=0
 LeftPanelClients=CodeExplorer@EditWindow0
 LeftPanelData=00000400010000000C000000436F64654578706C6F726572000000000000000000000000000000000001000000000000000000000000FFFFFFFF
 RightPanelSize=0
-BottomPanelSize=254
-BottomPanelClients=DockSite0
-BottomPanelData=0000040000000000770300000000000000D70000000000000001000000007703000009000000446F636B5369746530FFFFFFFF
+BottomPanelSize=152
+BottomPanelClients=DockSite1
+BottomPanelData=00000400000000002A030000000000000298000000000000000100000000770300000000000001000000002A03000009000000446F636B5369746531FFFFFFFF
 
 [View0]
 Module=P:\vista\tmg-cprs\CPRS-Chart\fImages.pas
-CursorX=1
-CursorY=1183
-TopLine=1174
+CursorX=8
+CursorY=1280
+TopLine=1261
 LeftCol=1
 
@@ -207,18 +182,11 @@
 
 [View2]
-Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtQuery.pas
-CursorX=1
-CursorY=156
-TopLine=147
+Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\uLogic.pas
+CursorX=34
+CursorY=637
+TopLine=623
 LeftCol=1
 
 [View3]
-Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\frmSearchResults.pas
-CursorX=1
-CursorY=108
-TopLine=99
-LeftCol=1
-
-[View4]
 Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\fPtAdd.pas
 CursorX=1
@@ -227,100 +195,86 @@
 LeftCol=1
 
+[View4]
+Module=P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas
+CursorX=1
+CursorY=4902
+TopLine=4888
+LeftCol=1
+
 [View5]
-Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\fWebTab.pas
-CursorX=5
-CursorY=79
-TopLine=71
+Module=P:\vista\tmg-cprs\CPRS-Chart\CPRSChart.dpr
+CursorX=69
+CursorY=365
+TopLine=26
 LeftCol=1
 
 [View6]
-Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\SearchAnimationU.pas
-CursorX=1
-CursorY=133
-TopLine=124
+Module=P:\vista\tmg-cprs\CPRS-Chart\uCore.pas
+CursorX=1
+CursorY=362
+TopLine=352
 LeftCol=1
 
 [View7]
-Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\SubfilesU.pas
-CursorX=7
-CursorY=205
-TopLine=198
+Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDocSearch.pas
+CursorX=1
+CursorY=144
+TopLine=134
 LeftCol=1
 
 [View8]
-Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\uLogic.pas
-CursorX=1
-CursorY=1113
-TopLine=1104
+Module=P:\Vista\tmg-cprs\CPRS-Lib\ORCtrls.pas
+CursorX=1
+CursorY=4358
+TopLine=4348
 LeftCol=1
 
 [View9]
-Module=P:\vista\tmg-cprs\CPRS-Chart\Options\rOptions.pas
-CursorX=5
-CursorY=206
-TopLine=199
+Module=c:\program files\borland\delphi7\source\vcl\ExtCtrls.pas
+CursorX=1
+CursorY=1650
+TopLine=1640
 LeftCol=1
 
 [View10]
-Module=P:\Vista\tmg-cprs\CPRS-Lib\ORNet.pas
-CursorX=23
-CursorY=380
-TopLine=367
+Module=c:\program files\borland\delphi7\source\vcl\StdCtrls.pas
+CursorX=1
+CursorY=2033
+TopLine=2023
 LeftCol=1
 
 [View11]
-Module=c:\program files\borland\delphi7\source\rtl\Sys\sysutils.pas
-CursorX=1
-CursorY=6473
-TopLine=6466
+Module=c:\program files\borland\delphi7\source\vcl\Controls.pas
+CursorX=1
+CursorY=6245
+TopLine=6229
 LeftCol=1
 
 [View12]
-Module=P:\vista\tmg-cprs\CPRS-Chart\rCore.pas
-CursorX=1
-CursorY=402
-TopLine=396
+Module=C:\PROGRA~1\VISTA\BDK32\Source\Wsockc.pas
+CursorX=1
+CursorY=1479
+TopLine=1469
 LeftCol=1
 
 [View13]
-Module=P:\vista\tmg-cprs\CPRS-Chart\fFrame.pas
-CursorX=5
-CursorY=4970
-TopLine=4971
+Module=P:\vista\tmg-cprs\CPRS-Chart\rHTMLTools.pas
+CursorX=9
+CursorY=842
+TopLine=817
 LeftCol=1
 
 [View14]
 Module=P:\vista\tmg-cprs\CPRS-Chart\UploadImages.pas
-CursorX=1
-CursorY=498
-TopLine=491
+CursorX=36
+CursorY=872
+TopLine=865
 LeftCol=1
 
 [View15]
-Module=P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas
-CursorX=1
-CursorY=4691
-TopLine=4679
-LeftCol=1
-
-[View16]
-Module=P:\vista\tmg-cprs\CPRS-Chart\fSplash.pas
-CursorX=61
-CursorY=2
-TopLine=1
-LeftCol=1
-
-[View17]
 Module=P:\vista\tmg-cprs\CPRS-Chart\fPtSel.pas
-CursorX=1
-CursorY=1303
-TopLine=1301
-LeftCol=1
-
-[View18]
-Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtAdd.pas
-CursorX=22
-CursorY=481
-TopLine=474
+CursorX=24
+CursorY=320
+TopLine=306
 LeftCol=1
 
@@ -329,6 +283,6 @@
 Visible=0
 State=0
-Left=200
-Top=115
+Left=250
+Top=153
 Width=639
 Height=453
@@ -340,9 +294,6 @@
 
 [Watches]
-Count=4
-Watch0='ImagesList.Strings[0]',256,0,18,1,0,'Watches'
-Watch1='ImagesList.Strings[1]',256,0,18,1,0,'Watches'
-Watch2='ImagesList.Strings[2]',256,0,18,1,0,'Watches'
-Watch3='frmImagePickExisting.SelectedIndex',256,0,18,1,0,'Watches'
+Count=1
+Watch0='Lines.Strings[i]',256,0,18,1,0,'Watches'
 
 [WatchWindow]
@@ -354,10 +305,10 @@
 Left=0
 Top=0
-Width=688
-Height=225
-MaxLeft=-1
-MaxTop=-1
-ClientWidth=688
-ClientHeight=225
+Width=790
+Height=123
+MaxLeft=-1
+MaxTop=-1
+ClientWidth=790
+ClientHeight=123
 TBDockHeight=103
 LRDockWidth=421
@@ -365,13 +316,13 @@
 
 [Breakpoints]
-Count=39
+Count=42
 Breakpoint0='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDemoEdit.pas',1714,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint1='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDemoEdit.pas',1791,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint2='P:\vista\tmg-cprs\CPRS-Chart\fDrawers.pas',1068,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint3='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',3288,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint4='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',3294,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint5='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',4388,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint6='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',4829,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint7='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',4849,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint3='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',3290,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint4='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',3296,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint5='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',4390,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint6='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',4831,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint7='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',4851,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint8='P:\vista\tmg-cprs\CPRS-Chart\fLabs.pas',2419,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint9='P:\vista\tmg-cprs\CPRS-Chart\fReports.pas',2966,'',0,1,'',1,0,0,'',1,'','',''
@@ -380,10 +331,10 @@
 Breakpoint12='P:\vista\tmg-cprs\CPRS-Chart\Encounter\fEncounterFrame.pas',846,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint13='P:\vista\tmg-cprs\CPRS-Chart\fReview.pas',1350,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint14='P:\vista\tmg-cprs\CPRS-Chart\rHTMLTools.pas',169,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint14='P:\vista\tmg-cprs\CPRS-Chart\rHTMLTools.pas',173,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint15='P:\vista\tmg-cprs\CPRS-Chart\Templates\uTemplates.pas',2545,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint16='P:\vista\tmg-cprs\CPRS-Chart\Templates\uTemplates.pas',2842,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint17='P:\vista\tmg-cprs\CPRS-Chart\Templates\fTemplateFields.pas',143,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint18='P:\vista\tmg-cprs\CPRS-Chart\Templates\uTemplateFields.pas',1128,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint19='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',1897,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint19='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',1899,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint20='P:\vista\tmg-cprs\CPRS-Chart\Templates\uTemplateFields.pas',1133,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint21='P:\vista\tmg-cprs\CPRS-Chart\Templates\uTemplateFields.pas',1126,'',0,1,'',1,0,0,'',1,'','',''
@@ -393,5 +344,5 @@
 Breakpoint25='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\TMGHTML2.pas',706,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint26='P:\vista\tmg-cprs\CPRS-Chart\fNotePrt.pas',86,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint27='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',784,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint27='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',786,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint28='P:\vista\tmg-cprs\CPRS-Chart\fNotePrt.pas',243,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint29='P:\vista\tmg-cprs\CPRS-Chart\Orders\fOrders.pas',2820,'',0,1,'',1,0,0,'',1,'','',''
@@ -403,6 +354,9 @@
 Breakpoint35='P:\vista\tmg-cprs\CPRS-Chart\fProbs.pas',1378,'',0,1,'',1,0,0,'',1,'','',''
 Breakpoint36='P:\vista\tmg-cprs\CPRS-Chart\Options\fOptions.pas',522,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint37='P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas',4671,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint38='P:\vista\tmg-cprs\CPRS-Chart\rCore.pas',402,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint37='P:\vista\tmg-cprs\CPRS-Chart\rHTMLTools.pas',251,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint38='P:\vista\tmg-cprs\CPRS-Chart\rHTMLTools.pas',254,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint39='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDocSearch.pas',144,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint40='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDocSearch.pas',93,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint41='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDocSearch.pas',127,'',0,1,'',1,0,0,'',1,'','',''
 
 [AddressBreakpoints]
@@ -413,5 +367,5 @@
 Visible=1
 State=0
-Left=11
+Left=14
 Top=0
 Width=1013
@@ -458,6 +412,6 @@
 Visible=0
 State=0
-Left=31
-Top=162
+Left=39
+Top=216
 Width=731
 Height=488
@@ -501,5 +455,5 @@
 SplitPos=114
 ArrangeBy=Name
-SelectedItem=Caption
+SelectedItem=
 ExpandedItems=Anchors,CalColors,Constraints,EdgeBorders,Font,Images,Options
 HiddenCategories=Legacy
@@ -529,8 +483,8 @@
 [CallStackWindow]
 Create=1
-Visible=1
-State=0
-Left=13
-Top=161
+Visible=0
+State=0
+Left=19
+Top=168
 Width=321
 Height=521
@@ -639,6 +593,6 @@
 Visible=0
 State=0
-Left=307
-Top=281
+Left=384
+Top=375
 Width=457
 Height=250
@@ -705,14 +659,14 @@
 [MessageView@EditWindow0]
 Create=1
-Visible=1
+Visible=0
 State=0
 Left=0
 Top=0
-Width=688
-Height=225
-MaxLeft=-1
-MaxTop=-1
-ClientWidth=688
-ClientHeight=225
+Width=790
+Height=123
+MaxLeft=-1
+MaxTop=-1
+ClientWidth=790
+ClientHeight=123
 TBDockHeight=215
 LRDockWidth=443
@@ -723,24 +677,4 @@
 
 [DockSite0]
-DockSiteType=1
-Create=1
-Visible=1
-State=0
-Left=12
-Top=0
-Width=696
-Height=254
-MaxLeft=-1
-MaxTop=-1
-ClientWidth=696
-ClientHeight=254
-TBDockHeight=254
-LRDockWidth=283
-Dockable=1
-TabPosition=0
-ActiveTab=Messages
-TabDockClients=MessageView@EditWindow0,WatchWindow
-
-[DockSite1]
 DockSiteType=1
 Create=1
@@ -762,2 +696,22 @@
 TabDockClients=PropertyInspector,ObjectTree
 
+[DockSite1]
+DockSiteType=1
+Create=1
+Visible=1
+State=0
+Left=12
+Top=0
+Width=798
+Height=152
+MaxLeft=-1
+MaxTop=-1
+ClientWidth=798
+ClientHeight=152
+TBDockHeight=152
+LRDockWidth=283
+Dockable=1
+TabPosition=0
+ActiveTab=Watch List
+TabDockClients=MessageView@EditWindow0,WatchWindow
+
Index: cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart_TLB.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart_TLB.pas	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart_TLB.pas	(revision 809)
@@ -13,5 +13,5 @@
 
 // PASTLWTR : 1.2
-// File generated on 6/16/2010 3:23:35 PM from Type Library described below.
+// File generated on 6/21/2010 2:19:10 PM from Type Library described below.
 
 // ************************************************************************  //
Index: cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fPtQuery.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fPtQuery.pas	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fPtQuery.pas	(revision 809)
@@ -127,5 +127,4 @@
     cmd := cmd + '^' + SearchFileNumber + '^' + SearchString;
     RPCBrokerV.Param[0].Mult['"REQUEST"'] := cmd;
-    //RPCBrokerV.Call;
     CallBroker;
     if RPCBrokerV.Results.Count > 0 then begin
@@ -152,5 +151,4 @@
     cmd := cmd + '^' + JobNumber + '^' + FldNum;
     RPCBrokerV.Param[0].Mult['"REQUEST"'] := cmd;
-    //RPCBrokerV.Call;
     CallBroker;
 
Index: cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fWebTab.dfm
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fWebTab.dfm	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fWebTab.dfm	(revision 809)
@@ -1,7 +1,7 @@
 object frmWebTab: TfrmWebTab
-  Left = 266
-  Top = 184
-  Width = 473
-  Height = 375
+  Left = 267
+  Top = 185
+  Width = 472
+  Height = 374
   Caption = 'Web Browser'
   Color = clBtnFace
@@ -18,10 +18,10 @@
     Left = 0
     Top = 0
-    Width = 465
-    Height = 341
+    Width = 464
+    Height = 340
     Align = alClient
     TabOrder = 0
     ControlData = {
-      4C0000000F3000003E2300000000000000000000000000000000000000000000
+      4C000000F52F0000242300000000000000000000000000000000000000000000
       000000004C000000000000000000000001000000E0D057007335CF11AE690800
       2B2E126208000000000000004C0000000114020000000000C000000000000046
Index: cprs/branches/tmg-cprs/CPRS-Chart/UploadImages.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/UploadImages.pas	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/UploadImages.pas	(revision 809)
@@ -583,4 +583,5 @@
     end;
     Info.Free;
+    frmImages.NumImagesAvailableOnServer := NOT_YET_CHECKED_SERVER;   //Forces re-query of server
   end;
 
@@ -869,8 +870,7 @@
       Text.Add('<p>');
       for i := 0 to UploadNote.CurNoteImages.Count-1 do begin
-        // note: $CPRSDIR$ will be replaced at runtime with directory of CPRS
+        // note: CPRS_DIR_SIGNAL ('$CPRSDIR$') will be replaced at runtime with directory of CPRS
         // This will be done as page is passed to TWebBrowser (in rHTMLTools)
-        oneImage := '$CPRSDIR$\Cache\' + UploadNote.CurNoteImages.Strings[i];  
-        //oneImage := CacheDir + '\' + CurNoteImages.Strings[i];
+        oneImage := CPRS_CACHE_DIR_SIGNAL + UploadNote.CurNoteImages.Strings[i];
         Text.Add('<img WIDTH=640 src="'+oneImage+'">');
         Text.Add('<p>');
Index: cprs/branches/tmg-cprs/CPRS-Chart/fImages.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fImages.pas	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fImages.pas	(revision 809)
@@ -99,5 +99,4 @@
     ImageInfoList : TList;
     LastDisplayedTIUIEN : AnsiString;
-    NumImagesAvailableOnServer : integer;
     ImageIndexLastDownloaded : integer;
     procedure EnsureImageListLoaded();
@@ -118,4 +117,5 @@
     DropBoxDir : string;
     NullImageName : AnsiString;
+    NumImagesAvailableOnServer : integer;
     DownloadImagesInBackground : boolean;
     function Decode(input: AnsiString) : AnsiString;
Index: cprs/branches/tmg-cprs/CPRS-Chart/fNotes.dfm
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fNotes.dfm	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fNotes.dfm	(revision 809)
@@ -1198,4 +1198,8 @@
         OnClick = mnuActIdentifyAddlSignersClick
       end
+      object mnuSearchNotes: TMenuItem
+        Caption = '&Search Notes'
+        OnClick = mnuSearchNotesClick
+      end
     end
     object mnuOptions: TMenuItem
@@ -1448,5 +1452,5 @@
     LangData = {
       080066726D4E6F746573010200000001000000070043617074696F6E02000000
-      080048656C7046696C6501A60000000D0073687050616765426F74746F6D0000
+      080048656C7046696C6501A70000000D0073687050616765426F74746F6D0000
       0700737074486F727A00000700706E6C4C65667400000800706E6C5269676874
       000008006C626C4E6F746573010100000003000000070043617074696F6E0009
@@ -1608,5 +1612,6 @@
       78697374696E67496D6167650101000000A1000000070043617074696F6E000E
       006D6E754164644E6577496D6167650101000000A2000000070043617074696F
-      6E00}
+      6E000E006D6E755365617263684E6F7465730101000000A30000000700436170
+      74696F6E00}
   end
   object popupAddImage: TPopupMenu
Index: cprs/branches/tmg-cprs/CPRS-Chart/fNotes.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fNotes.pas	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fNotes.pas	(revision 809)
@@ -183,5 +183,6 @@
     popupAddImage: TPopupMenu;
     mnuSelectExistingImage: TMenuItem;
-    mnuAddNewImage: TMenuItem;                //kt 4/10
+    mnuAddNewImage: TMenuItem;
+    mnuSearchNotes: TMenuItem;                //kt 4/10
     procedure mnuChartTabClick(Sender: TObject);
     procedure lstNotesClick(Sender: TObject);
@@ -294,5 +295,6 @@
     procedure popNoteMemoHTMLFormatClick(Sender: TObject);
     procedure mnuAddNewImageClick(Sender: TObject);
-    procedure mnuSelectExistingImageClick(Sender: TObject); //kt 8/09
+    procedure mnuSelectExistingImageClick(Sender: TObject);
+    procedure mnuSearchNotesClick(Sender: TObject); //kt 8/09
   private
     FNavigatingTab : Boolean; //Currently Using tab to navigate
@@ -407,5 +409,6 @@
      fOptionsNotes, //kt 8/09
      fImagePickExisting, //kt 6/16/10
-     rHTMLTools, fImages, UploadImages;  {//kt added 5-27-05 for IsHTMLDocument}
+     rHTMLTools, fImages, UploadImages,  {//kt added 5-27-05 for IsHTMLDocument}
+     fPtDocSearch;        //kt 6/21/10
 
 const
@@ -4890,5 +4893,12 @@
 end;
 
-
+procedure TfrmNotes.mnuSearchNotesClick(Sender: TObject);
+begin
+  inherited;
+  Application.CreateForm(TfrmPtDocSearch, frmPtDocSearch);
+  frmPtDocSearch.ShowModal;
+  //open diff note it selected
+  frmPtDocSearch.Free;
+end;
 
 initialization
Index: cprs/branches/tmg-cprs/CPRS-Chart/fPtSel.dfm
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fPtSel.dfm	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fPtSel.dfm	(revision 809)
@@ -1,5 +1,5 @@
 object frmPtSel: TfrmPtSel
-  Left = 108
-  Top = 100
+  Left = 344
+  Top = 171
   Width = 797
   Height = 622
Index: cprs/branches/tmg-cprs/CPRS-Chart/fSplash.dfm
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fSplash.dfm	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fSplash.dfm	(revision 809)
@@ -1,5 +1,5 @@
 object frmSplash: TfrmSplash
-  Left = 245
-  Top = 129
+  Left = 286
+  Top = 131
   BorderIcons = []
   BorderStyle = bsNone
@@ -4142,5 +4142,5 @@
       Height = 17
       Alignment = taCenter
-      Caption = 'TMG Customization 2.0; 6.16.2010'
+      Caption = 'TMG Customization 2.0; 6.18.2010'
       Font.Charset = ANSI_CHARSET
       Font.Color = clGray
Index: cprs/branches/tmg-cprs/CPRS-Chart/rHTMLTools.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/rHTMLTools.pas	(revision 801)
+++ cprs/branches/tmg-cprs/CPRS-Chart/rHTMLTools.pas	(revision 809)
@@ -18,5 +18,8 @@
     URL_CPRSDir : string;  //This is CPRSDir, but all '\'s are converted to '/'s
 
-  CONST ALT_IMG_TAG_CONVERT = 'alt="convert to $CPRSDIR$"';
+  CONST
+    CPRS_DIR_SIGNAL = '$CPRSDIR$';
+    CPRS_CACHE_DIR_SIGNAL = CPRS_DIR_SIGNAL+'\Cache\';
+    ALT_IMG_TAG_CONVERT = 'alt="convert to ' + CPRS_DIR_SIGNAL +'"';
 
   procedure PrintHTMLReport(Lines: TStringList; var ErrMsg: string;
@@ -43,4 +46,5 @@
   Procedure ScanForSubs(Lines : TStrings);
   Procedure InsertSubs(Lines : TStrings);
+  function HTTPEncode(const AStr: string): string;
 
 implementation
@@ -217,14 +221,14 @@
     SubsFoundList.Clear;
     for i := 0 to Lines.Count-1 do begin
-      p := Pos('$CPRSDIR$',Lines.Strings[i]);
+      p := Pos(CPRS_DIR_SIGNAL,Lines.Strings[i]);
       if p>0 then begin
-        p := p + Length('$CPRSDIR$\Cache\');
+        p := p + Length(CPRS_CACHE_DIR_SIGNAL);
         p2 := PosEx('"',Lines.Strings[i],p);
         tempS := MidStr(Lines.Strings[i],p,(p2-p));
         SubsFoundList.Add(tempS);
         if Pos('file:///',Lines.Strings[i]) > 0 then begin
-          Lines.Strings[i] := AnsiReplaceStr(Lines.Strings[i],'$CPRSDIR$',URL_CPRSDir);
+          Lines.Strings[i] := AnsiReplaceStr(Lines.Strings[i],CPRS_DIR_SIGNAL,URL_CPRSDir);
         end else begin
-          Lines.Strings[i] := AnsiReplaceStr(Lines.Strings[i],'$CPRSDIR$',CPRSDir);
+          Lines.Strings[i] := AnsiReplaceStr(Lines.Strings[i],CPRS_DIR_SIGNAL,CPRSDir);
         end;
         //Ensure images are downloaded before passing page to web browser
@@ -237,5 +241,5 @@
   Procedure InsertSubs(Lines : TStrings);
   //Purpose: To scan a edited note images, and replace references to CPRS's
-  //         actual local directory with $CPRS$
+  //         actual local directory with CPRS_DIR_SIGNAL ('$CPRSDIR$')
   var i,p : integer;
      TempS: string;
@@ -243,12 +247,15 @@
   begin
     for i := 0 to Lines.Count-1 do begin
-      Lines.Strings[i] := AnsiReplaceStr(Lines.Strings[i],URL_CPRSDir,'$CPRSDIR$');
+      p := pos(ALT_IMG_TAG_CONVERT,Lines.Strings[i]);
+      if p = 0 then continue;
+      TempS := Lines.Strings[i];
+      Lines.Strings[i] := AnsiReplaceStr(Lines.Strings[i],URL_CPRSDir,CPRS_DIR_SIGNAL);
+      if Lines.Strings[i] = TempS then begin  //There is a problem. Replacement failed.
+        MessageDlg('Problem converting image path to $CPRSDIR$',mtWarning,[mbOK],0);
+      end;
+      //TempS := MidStr(Lines.Strings[i],1,p-1);
+      //TempS := TempS + MidStr(Lines.Strings[i],p+length(ALT_IMG_TAG_CONVERT),length(Lines.Strings[i])+1);
+      //Lines.Strings[i] := TempS;
       Lines.Strings[i] := AnsiReplaceStr(Lines.Strings[i],ALT_IMG_TAG_CONVERT,'IMAGE'); //Remove signal
-      p := pos(ALT_IMG_TAG_CONVERT,Lines.Strings[i]);
-      if p > 0 then begin
-        TempS := MidStr(Lines.Strings[i],1,p-1);
-        TempS := TempS + MidStr(Lines.Strings[i],p+length(ALT_IMG_TAG_CONVERT),length(Lines.Strings[i])+1);
-        Lines.Strings[i] := TempS;
-      end;
     end;
   end;
@@ -504,5 +511,5 @@
     Result := AnsiReplaceText(Result,'>'+CRLF,'>'#$1F); //protect sequences we want
     Result := AnsiReplaceText(Result,CRLF,'<BR>'+CRLF); //Add <BR>'s to CrLf's
-    Result := AnsiReplaceText(Result,'>'#$1F,'>'+CRLF); //Restore sequences we wanted
+    Result := AnsiReplaceText(Result,'>'#$1F,'><BR>'+CRLF); //Restore sequences we wanted
     Result := AnsiReplaceText(Result,#$1E,'<NO DATA>'); //Restore sequences we wanted
   end;
@@ -829,5 +836,9 @@
   //elh 6/19/09
   begin
-    if not assigned(Reg) then Reg := TRegistry.Create;
+    if not assigned(Reg) then begin
+       Reg := TRegistry.Create;
+       Reg.Rootkey := HKEY_CURRENT_USER;
+       Reg.OpenKey('\Software\Microsoft\Internet Explorer\PageSetup', False)
+    end;   
     try
       StoredIEFooters := '&u&b&d';          //Comment this line to restore previous value
@@ -853,7 +864,36 @@
       s := Piece(Lines.Strings[i],'DATE OF NOTE:',2);
       s := Piece(s,'@',1);
-      Result := Trim(s);      
-    end;
-  end;
+      Result := Trim(s);
+    end;
+  end;
+
+  function HTTPEncode(const AStr: string): string;
+  //NOTE: routine from here:
+  //   http://www.delphitricks.com/source-code/internet/encode_a_http_url.html
+  //NOTE: I modified this to my purposes.  I removed conversion of '/',':'
+  const
+    //kt original --> NoConversion = ['A'..'Z', 'a'..'z', '*', '@', '.', '_', '-'];
+    NoConversion = ['A'..'Z', 'a'..'z', '*', '@', '.', '_', '-', '/', ':'];  //kt
+  var
+    Sp, Rp: PChar;
+  begin
+    SetLength(Result, Length(AStr) * 3);
+    Sp := PChar(AStr);
+    Rp := PChar(Result);
+    while Sp^ <> #0 do begin
+      if Sp^ in NoConversion then
+        Rp^ := Sp^
+      //kt else if Sp^ = ' ' then
+      //kt   Rp^ := '+'
+      else begin
+        FormatBuf(Rp^, 3, '%%%.2x', 6, [Ord(Sp^)]);
+        Inc(Rp, 2);
+      end;
+      Inc(Rp);
+      Inc(Sp);
+    end;
+    SetLength(Result, Rp - PChar(Result));
+  end;
+
 
   //===============================================================
@@ -883,10 +923,15 @@
     RestorePrinterTimer.Enabled := false;
     RestoreIEPrinting;   {elh 6/19/09}  //kt
-    //kt SetDefaultPrinter(SavedDefaultPrinter);   
+    //kt SetDefaultPrinter(SavedDefaultPrinter);
     //beep;    
-  end;  
+  end;
 
   //===============================================================
-  
+
+  function EncodePath(var Path : string) : string;
+  begin
+    Result := AnsiReplaceStr(Path,'\','/');
+    Result := HTTPEncode(Result);
+  end;
 
 initialization
@@ -894,8 +939,10 @@
   PrinterEvents := TPrinterEvents.Create;
   CPRSDir := ExcludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)));
-  URL_CPRSDir := AnsiReplaceStr(CPRSDir,'\','/');
+  URL_CPRSDir := EncodePath(CPRSDir);
   SubsFoundList := TStringList.Create;
 
 finalization
+  //kt causing crash -->  Reg.WriteString('footer',StoredIEFooters);
+  //RestoreIEPrinting;
   PrinterEvents.Free;
   SubsFoundList.Free;
