Index: cprs/branches/tmg-cprs/CPRS-Chart/Accessibility_TLB.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/Accessibility_TLB.pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/Accessibility_TLB.pas	(revision 654)
@@ -13,5 +13,5 @@
 
 // PASTLWTR : 1.2
-// File generated on 11/27/2009 5:46:58 PM from Type Library described below.
+// File generated on 12/28/2009 9:26:13 PM from Type Library described below.
 
 // ************************************************************************  //
Index: cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dof
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dof	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dof	(revision 654)
@@ -101,5 +101,5 @@
 UsePackages=0
 [Parameters]
-RunParams=CCOW=disable s=localhost p=9260 SPOOF-VER=1.0.26.76
+RunParams=CCOW=disable s=192.168.3.97 p=9260 SPOOF-VER=1.0.26.69
 HostApplication=
 Launcher=
Index: cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.drc
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.drc	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.drc	(revision 654)
@@ -184,84 +184,84 @@
 #define QConsts_STooManyMessageBoxButtons 65102
 #define QConsts_SmkcBkSp 65103
-#define TeeConst_TeeMsg_ValuesArrowEndY 65104
-#define ComConst_SCreateRegKeyError 65105
-#define ComConst_SOleError 65106
-#define ComConst_SObjectFactoryMissing 65107
-#define ComConst_STypeInfoMissing 65108
-#define ComConst_SBadTypeInfo 65109
-#define ComConst_SDispIntfMissing 65110
-#define ComConst_SNoMethod 65111
-#define ComConst_SVarNotObject 65112
-#define ComConst_STooManyParams 65113
-#define ComConst_SDCOMNotInstalled 65114
-#define ComConst_SDAXError 65115
-#define ComConst_SAutomationWarning 65116
-#define ComConst_SNoCloseActiveServer1 65117
-#define ComConst_SNoCloseActiveServer2 65118
+#define TeeConst_TeeMsg_FunctionAverage 65104
+#define TeeConst_TeeMsg_DefaultFontName 65105
+#define TeeConst_TeeMsg_CheckPointerSize 65106
+#define TeeConst_TeeMsg_FunctionPeriod 65107
+#define TeeConst_TeeMsg_PieOther 65108
+#define TeeConst_TeeMsg_ValuesX 65109
+#define TeeConst_TeeMsg_ValuesY 65110
+#define TeeConst_TeeMsg_ValuesPie 65111
+#define TeeConst_TeeMsg_ValuesBar 65112
+#define TeeConst_TeeMsg_ValuesAngle 65113
+#define TeeConst_TeeMsg_ValuesGanttStart 65114
+#define TeeConst_TeeMsg_ValuesGanttEnd 65115
+#define TeeConst_TeeMsg_ValuesGanttNextTask 65116
+#define TeeConst_TeeMsg_ValuesArrowEndX 65117
+#define TeeConst_TeeMsg_ValuesArrowEndY 65118
 #define TntSystem_SBufferOverflow 65119
-#define TeeConst_TeeMsg_FunctionHigh 65120
-#define TeeConst_TeeMsg_FunctionLow 65121
-#define TeeConst_TeeMsg_FunctionAverage 65122
-#define TeeConst_TeeMsg_DefaultFontName 65123
-#define TeeConst_TeeMsg_CheckPointerSize 65124
-#define TeeConst_TeeMsg_FunctionPeriod 65125
-#define TeeConst_TeeMsg_PieOther 65126
-#define TeeConst_TeeMsg_ValuesX 65127
-#define TeeConst_TeeMsg_ValuesY 65128
-#define TeeConst_TeeMsg_ValuesPie 65129
-#define TeeConst_TeeMsg_ValuesBar 65130
-#define TeeConst_TeeMsg_ValuesAngle 65131
-#define TeeConst_TeeMsg_ValuesGanttStart 65132
-#define TeeConst_TeeMsg_ValuesGanttEnd 65133
-#define TeeConst_TeeMsg_ValuesGanttNextTask 65134
-#define TeeConst_TeeMsg_ValuesArrowEndX 65135
-#define TeeConst_TeeMsg_GalleryGantt 65136
-#define TeeConst_TeeMsg_GanttSample1 65137
-#define TeeConst_TeeMsg_GanttSample2 65138
-#define TeeConst_TeeMsg_GanttSample3 65139
-#define TeeConst_TeeMsg_GanttSample4 65140
-#define TeeConst_TeeMsg_GanttSample5 65141
-#define TeeConst_TeeMsg_GanttSample6 65142
-#define TeeConst_TeeMsg_GanttSample7 65143
-#define TeeConst_TeeMsg_GanttSample8 65144
-#define TeeConst_TeeMsg_GanttSample9 65145
-#define TeeConst_TeeMsg_GanttSample10 65146
-#define TeeConst_TeeMsg_DefaultFontSize 65147
-#define TeeConst_TeeMsg_FunctionAdd 65148
-#define TeeConst_TeeMsg_FunctionSubtract 65149
-#define TeeConst_TeeMsg_FunctionMultiply 65150
-#define TeeConst_TeeMsg_FunctionDivide 65151
-#define TeeConst_TeeMsg_GalleryBar 65152
-#define TeeConst_TeeMsg_GalleryHorizBar 65153
-#define TeeConst_TeeMsg_GalleryPie 65154
-#define TeeConst_TeeMsg_GalleryFastLine 65155
-#define TeeConst_TeeMsg_Rotation 65156
-#define TeeConst_TeeMsg_PieSample1 65157
-#define TeeConst_TeeMsg_PieSample2 65158
-#define TeeConst_TeeMsg_PieSample3 65159
-#define TeeConst_TeeMsg_PieSample4 65160
-#define TeeConst_TeeMsg_PieSample5 65161
-#define TeeConst_TeeMsg_PieSample6 65162
-#define TeeConst_TeeMsg_PieSample7 65163
-#define TeeConst_TeeMsg_PieSample8 65164
-#define TeeConst_TeeMsg_GalleryStandard 65165
-#define TeeConst_TeeMsg_GalleryFunctions 65166
-#define TeeConst_TeeMsg_GalleryArrow 65167
-#define TeeConst_TeeMsg_AxisMinMax 65168
-#define TeeConst_TeeMsg_AxisMaxMin 65169
-#define TeeConst_TeeMsg_AxisLogBase 65170
-#define TeeConst_TeeMsg_MaxPointsPerPage 65171
-#define TeeConst_TeeMsg_3dPercent 65172
-#define TeeConst_TeeMsg_CircularSeries 65173
-#define TeeConst_TeeMsg_BarWidthPercent 65174
-#define TeeConst_TeeMsg_BarOffsetPercent 65175
-#define TeeConst_TeeMsg_DefaultPercentOf 65176
-#define TeeConst_TeeMsg_DefPercentFormat 65177
-#define TeeConst_TeeMsg_DefValueFormat 65178
-#define TeeConst_TeeMsg_AxisTitle 65179
-#define TeeConst_TeeMsg_AxisLabels 65180
-#define TeeConst_TeeMsg_GalleryLine 65181
-#define TeeConst_TeeMsg_GalleryPoint 65182
-#define TeeConst_TeeMsg_GalleryArea 65183
+#define TeeConst_TeeMsg_GanttSample2 65120
+#define TeeConst_TeeMsg_GanttSample3 65121
+#define TeeConst_TeeMsg_GanttSample4 65122
+#define TeeConst_TeeMsg_GanttSample5 65123
+#define TeeConst_TeeMsg_GanttSample6 65124
+#define TeeConst_TeeMsg_GanttSample7 65125
+#define TeeConst_TeeMsg_GanttSample8 65126
+#define TeeConst_TeeMsg_GanttSample9 65127
+#define TeeConst_TeeMsg_GanttSample10 65128
+#define TeeConst_TeeMsg_DefaultFontSize 65129
+#define TeeConst_TeeMsg_FunctionAdd 65130
+#define TeeConst_TeeMsg_FunctionSubtract 65131
+#define TeeConst_TeeMsg_FunctionMultiply 65132
+#define TeeConst_TeeMsg_FunctionDivide 65133
+#define TeeConst_TeeMsg_FunctionHigh 65134
+#define TeeConst_TeeMsg_FunctionLow 65135
+#define TeeConst_TeeMsg_GalleryPie 65136
+#define TeeConst_TeeMsg_GalleryFastLine 65137
+#define TeeConst_TeeMsg_Rotation 65138
+#define TeeConst_TeeMsg_PieSample1 65139
+#define TeeConst_TeeMsg_PieSample2 65140
+#define TeeConst_TeeMsg_PieSample3 65141
+#define TeeConst_TeeMsg_PieSample4 65142
+#define TeeConst_TeeMsg_PieSample5 65143
+#define TeeConst_TeeMsg_PieSample6 65144
+#define TeeConst_TeeMsg_PieSample7 65145
+#define TeeConst_TeeMsg_PieSample8 65146
+#define TeeConst_TeeMsg_GalleryStandard 65147
+#define TeeConst_TeeMsg_GalleryFunctions 65148
+#define TeeConst_TeeMsg_GalleryArrow 65149
+#define TeeConst_TeeMsg_GalleryGantt 65150
+#define TeeConst_TeeMsg_GanttSample1 65151
+#define TeeConst_TeeMsg_AxisLogBase 65152
+#define TeeConst_TeeMsg_MaxPointsPerPage 65153
+#define TeeConst_TeeMsg_3dPercent 65154
+#define TeeConst_TeeMsg_CircularSeries 65155
+#define TeeConst_TeeMsg_BarWidthPercent 65156
+#define TeeConst_TeeMsg_BarOffsetPercent 65157
+#define TeeConst_TeeMsg_DefaultPercentOf 65158
+#define TeeConst_TeeMsg_DefPercentFormat 65159
+#define TeeConst_TeeMsg_DefValueFormat 65160
+#define TeeConst_TeeMsg_AxisTitle 65161
+#define TeeConst_TeeMsg_AxisLabels 65162
+#define TeeConst_TeeMsg_GalleryLine 65163
+#define TeeConst_TeeMsg_GalleryPoint 65164
+#define TeeConst_TeeMsg_GalleryArea 65165
+#define TeeConst_TeeMsg_GalleryBar 65166
+#define TeeConst_TeeMsg_GalleryHorizBar 65167
+#define ComConst_SAutomationWarning 65168
+#define ComConst_SNoCloseActiveServer1 65169
+#define ComConst_SNoCloseActiveServer2 65170
+#define TeeConst_TeeMsg_LegendTopPos 65171
+#define TeeConst_TeeMsg_LegendFirstValue 65172
+#define TeeConst_TeeMsg_LegendColorWidth 65173
+#define TeeConst_TeeMsg_SeriesSetDataSource 65174
+#define TeeConst_TeeMsg_SeriesInvDataSource 65175
+#define TeeConst_TeeMsg_FillSample 65176
+#define TeeConst_TeeMsg_Angle 65177
+#define TeeConst_TeeMsg_AxisLogDateTime 65178
+#define TeeConst_TeeMsg_AxisLogNotPositive 65179
+#define TeeConst_TeeMsg_AxisLabelSep 65180
+#define TeeConst_TeeMsg_AxisIncrementNeg 65181
+#define TeeConst_TeeMsg_AxisMinMax 65182
+#define TeeConst_TeeMsg_AxisMaxMin 65183
 #define ComStrs_sFailSetCalDateTime 65184
 #define ComStrs_sFailSetCalMaxSelRange 65185
@@ -269,15 +269,15 @@
 #define ComStrs_sFailsetCalSelRange 65187
 #define WinHelpViewer_hNoKeyword 65188
-#define TeeConst_TeeMsg_LegendTopPos 65189
-#define TeeConst_TeeMsg_LegendFirstValue 65190
-#define TeeConst_TeeMsg_LegendColorWidth 65191
-#define TeeConst_TeeMsg_SeriesSetDataSource 65192
-#define TeeConst_TeeMsg_SeriesInvDataSource 65193
-#define TeeConst_TeeMsg_FillSample 65194
-#define TeeConst_TeeMsg_Angle 65195
-#define TeeConst_TeeMsg_AxisLogDateTime 65196
-#define TeeConst_TeeMsg_AxisLogNotPositive 65197
-#define TeeConst_TeeMsg_AxisLabelSep 65198
-#define TeeConst_TeeMsg_AxisIncrementNeg 65199
+#define ComConst_SCreateRegKeyError 65189
+#define ComConst_SOleError 65190
+#define ComConst_SObjectFactoryMissing 65191
+#define ComConst_STypeInfoMissing 65192
+#define ComConst_SBadTypeInfo 65193
+#define ComConst_SDispIntfMissing 65194
+#define ComConst_SNoMethod 65195
+#define ComConst_SVarNotObject 65196
+#define ComConst_STooManyParams 65197
+#define ComConst_SDCOMNotInstalled 65198
+#define ComConst_SDAXError 65199
 #define ComStrs_sTabFailGetObject 65200
 #define ComStrs_sTabFailSet 65201
@@ -793,22 +793,4 @@
 	QConsts_STooManyMessageBoxButtons,	"Too many buttons specified for message box"
 	QConsts_SmkcBkSp,	"Backspace"
-	TeeConst_TeeMsg_ValuesArrowEndY,	"EndY"
-	ComConst_SCreateRegKeyError,	"Error creating system registry entry"
-	ComConst_SOleError,	"OLE error %.8x"
-	ComConst_SObjectFactoryMissing,	"Object factory for class %s missing"
-	ComConst_STypeInfoMissing,	"Type information missing for class %s"
-	ComConst_SBadTypeInfo,	"Incorrect type information for class %s"
-	ComConst_SDispIntfMissing,	"Dispatch interface missing from class %s"
-	ComConst_SNoMethod,	"Method '%s' not supported by automation object"
-	ComConst_SVarNotObject,	"Variant does not reference an automation object"
-	ComConst_STooManyParams,	"Dispatch methods do not support more than 64 parameters"
-	ComConst_SDCOMNotInstalled,	"DCOM not installed"
-	ComConst_SDAXError,	"DAX Error"
-	ComConst_SAutomationWarning,	"COM Server Warning"
-	ComConst_SNoCloseActiveServer1,	"There are still active COM objects in this application.  One or more clients may have references to these objects, so manually closing "
-	ComConst_SNoCloseActiveServer2,	"this application may cause those client application(s) to fail.\r\n\r\nAre you sure you want to close this application?"
-	TntSystem_SBufferOverflow,	"Buffer overflow"
-	TeeConst_TeeMsg_FunctionHigh,	"High"
-	TeeConst_TeeMsg_FunctionLow,	"Low"
 	TeeConst_TeeMsg_FunctionAverage,	"Average"
 	TeeConst_TeeMsg_DefaultFontName,	"Arial"
@@ -825,6 +807,6 @@
 	TeeConst_TeeMsg_ValuesGanttNextTask,	"NextTask"
 	TeeConst_TeeMsg_ValuesArrowEndX,	"EndX"
-	TeeConst_TeeMsg_GalleryGantt,	"Gantt"
-	TeeConst_TeeMsg_GanttSample1,	"Design"
+	TeeConst_TeeMsg_ValuesArrowEndY,	"EndY"
+	TntSystem_SBufferOverflow,	"Buffer overflow"
 	TeeConst_TeeMsg_GanttSample2,	"Prototyping"
 	TeeConst_TeeMsg_GanttSample3,	"Development"
@@ -841,6 +823,6 @@
 	TeeConst_TeeMsg_FunctionMultiply,	"Multiply"
 	TeeConst_TeeMsg_FunctionDivide,	"Divide"
-	TeeConst_TeeMsg_GalleryBar,	"Bar"
-	TeeConst_TeeMsg_GalleryHorizBar,	"Horiz. Bar"
+	TeeConst_TeeMsg_FunctionHigh,	"High"
+	TeeConst_TeeMsg_FunctionLow,	"Low"
 	TeeConst_TeeMsg_GalleryPie,	"Pie"
 	TeeConst_TeeMsg_GalleryFastLine,	"Fast Line"
@@ -857,6 +839,6 @@
 	TeeConst_TeeMsg_GalleryFunctions,	"Functions"
 	TeeConst_TeeMsg_GalleryArrow,	"Arrow"
-	TeeConst_TeeMsg_AxisMinMax,	"Axis Minimum Value must be <= Maximum"
-	TeeConst_TeeMsg_AxisMaxMin,	"Axis Maximum Value must be >= Minimum"
+	TeeConst_TeeMsg_GalleryGantt,	"Gantt"
+	TeeConst_TeeMsg_GanttSample1,	"Design"
 	TeeConst_TeeMsg_AxisLogBase,	"Axis Logarithmic Base should be >= 2"
 	TeeConst_TeeMsg_MaxPointsPerPage,	"MaxPointsPerPage must be >= 0"
@@ -873,9 +855,9 @@
 	TeeConst_TeeMsg_GalleryPoint,	"Point"
 	TeeConst_TeeMsg_GalleryArea,	"Area"
-	ComStrs_sFailSetCalDateTime,	"Failed to set calendar date or time"
-	ComStrs_sFailSetCalMaxSelRange,	"Failed to set maximum selection range"
-	ComStrs_sFailSetCalMinMaxRange,	"Failed to set calendar min/max range"
-	ComStrs_sFailsetCalSelRange,	"Failed to set calendar selected range"
-	WinHelpViewer_hNoKeyword,	"No help keyword specified."
+	TeeConst_TeeMsg_GalleryBar,	"Bar"
+	TeeConst_TeeMsg_GalleryHorizBar,	"Horiz. Bar"
+	ComConst_SAutomationWarning,	"COM Server Warning"
+	ComConst_SNoCloseActiveServer1,	"There are still active COM objects in this application.  One or more clients may have references to these objects, so manually closing "
+	ComConst_SNoCloseActiveServer2,	"this application may cause those client application(s) to fail.\r\n\r\nAre you sure you want to close this application?"
 	TeeConst_TeeMsg_LegendTopPos,	"Top Legend Position must be between 0 and 100 %"
 	TeeConst_TeeMsg_LegendFirstValue,	"First Legend Value must be > 0"
@@ -889,4 +871,22 @@
 	TeeConst_TeeMsg_AxisLabelSep,	"Labels Separation % must be greater than 0"
 	TeeConst_TeeMsg_AxisIncrementNeg,	"Axis increment must be >= 0"
+	TeeConst_TeeMsg_AxisMinMax,	"Axis Minimum Value must be <= Maximum"
+	TeeConst_TeeMsg_AxisMaxMin,	"Axis Maximum Value must be >= Minimum"
+	ComStrs_sFailSetCalDateTime,	"Failed to set calendar date or time"
+	ComStrs_sFailSetCalMaxSelRange,	"Failed to set maximum selection range"
+	ComStrs_sFailSetCalMinMaxRange,	"Failed to set calendar min/max range"
+	ComStrs_sFailsetCalSelRange,	"Failed to set calendar selected range"
+	WinHelpViewer_hNoKeyword,	"No help keyword specified."
+	ComConst_SCreateRegKeyError,	"Error creating system registry entry"
+	ComConst_SOleError,	"OLE error %.8x"
+	ComConst_SObjectFactoryMissing,	"Object factory for class %s missing"
+	ComConst_STypeInfoMissing,	"Type information missing for class %s"
+	ComConst_SBadTypeInfo,	"Incorrect type information for class %s"
+	ComConst_SDispIntfMissing,	"Dispatch interface missing from class %s"
+	ComConst_SNoMethod,	"Method '%s' not supported by automation object"
+	ComConst_SVarNotObject,	"Variant does not reference an automation object"
+	ComConst_STooManyParams,	"Dispatch methods do not support more than 64 parameters"
+	ComConst_SDCOMNotInstalled,	"DCOM not installed"
+	ComConst_SDAXError,	"DAX Error"
 	ComStrs_sTabFailGetObject,	"Failed to get object at index %d"
 	ComStrs_sTabFailSet,	"Failed to set tab \"%s\" at index %d"
Index: cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dsk
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dsk	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart.dsk	(revision 654)
@@ -1,72 +1,19 @@
 [Closed Files]
-File_0=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\fDrawers.pas',0,1,189,1,207,0,0
-File_1=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\fNotePrt.pas',0,1,231,19,242,0,0
-File_2=SourceModule,'P:\vista\tmg-cprs\CPRSChart.ini',0,1,1,9,18,0,0
-File_3=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\Options\fOptionsOther.pas',0,1,343,29,349,1,0
-File_4=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\Options\fOptions.pas',0,1,731,1,736,1,0
-File_5=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\rHTMLTools.pas',0,1,551,41,562,0,0
-File_6=SourceModule,'c:\program files\borland\delphi7\source\rtl\Win\Windows.pas',0,1,28958,88,28963,0,0
-File_7=SourceModule,'P:\vista\CPRS-1.0.23.15\CPRS-Chart\fDrawers.pas',0,1,1605,1,1614,0,0
-File_8=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\rCore.pas',0,1,933,1,945,0,0
+File_0=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\dShared.pas',0,1,1,1,1,0,0
+File_1=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\fDrawers.pas',0,1,975,1,986,0,0
+File_2=SourceModule,'c:\program files\borland\delphi7\source\vcl\ComCtrls.pas',0,1,8808,1,8828,0,0
+File_3=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\Templates\fTemplateDialog.pas',0,1,88,51,95,0,0
+File_4=SourceModule,'c:\program files\borland\delphi7\source\rtl\Sys\variants.pas',0,1,740,1,747,0,0
+File_5=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\EmbeddedED\EmbeddedED.pas',0,1,3123,1,3130,0,0
+File_6=SourceModule,'c:\program files\borland\delphi7\source\rtl\common\classes.pas',0,1,4201,1,4214,0,0
+File_7=SourceModule,'c:\program files\borland\delphi7\source\vcl\Controls.pas',0,1,5874,1,5887,0,0
+File_8=SourceModule,'P:\vista\tmg-cprs\CPRS-Chart\Templates\uTemplateFields.pas',0,1,629,1,636,0,0
 
 [Modules]
-Module0=P:\vista\tmg-cprs\CPRS-Chart\fImages.pas
-Module1=P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas
-Module2=P:\vista\tmg-cprs\CPRS-Chart\fxBroker.pas
-Module3=P:\Vista\tmg-cprs\CPRS-Lib\ORSystem.pas
-Module4=P:\vista\tmg-cprs\CPRS-Chart\fFrame.pas
-Module5=P:\vista\tmg-cprs\CPRS-Lib\ORNet.pas
-Module6=c:\program files\borland\delphi7\source\rtl\Sys\sysutils.pas
-Module7=C:\PROGRA~1\VISTA\BDK32\Source\wsockc.pas
-Module8=P:\vista\tmg-cprs\CPRS-Chart\Orders\fODBase.pas
-Module9=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\TMGHTML2.pas
-Count=10
+Module0=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\TMGHTML2.pas
+Module1=P:\vista\tmg-cprs\CPRS-Chart\CPRSChart.dpr
+Count=2
 EditWindowCount=1
 TypeLibWindowCount=1
-
-[P:\vista\tmg-cprs\CPRS-Chart\fImages.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\fxBroker.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\Vista\tmg-cprs\CPRS-Lib\ORSystem.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\fFrame.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Lib\ORNet.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[c:\program files\borland\delphi7\source\rtl\Sys\sysutils.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\Orders\fODBase.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
 
 [P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\TMGHTML2.pas]
@@ -75,45 +22,22 @@
 FormOnTop=0
 
+[P:\vista\tmg-cprs\CPRS-Chart\CPRSChart.dpr]
+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
 FormOnTop=0
 
-[P:\vista\tmg-cprs\CPRS-Chart\fAutoSz.pas]
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\dShared.pas]
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\fHSplit.pas]
-FormState=0
-FormOnTop=0
-
-[P:\vista\tmg-cprs\CPRS-Chart\fPage.pas]
-FormState=0
-FormOnTop=0
-
 [EditWindow0]
-ViewCount=10
-CurrentView=7
+ViewCount=2
+CurrentView=1
 View0=0
 View1=1
-View2=2
-View3=3
-View4=4
-View5=5
-View6=6
-View7=7
-View8=8
-View9=9
 CodeExplorer=CodeExplorer@EditWindow0
 MessageView=MessageView@EditWindow0
@@ -121,88 +45,32 @@
 Visible=1
 State=0
-Left=-794
-Top=176
-Width=787
-Height=569
-MaxLeft=-4
-MaxTop=104
-ClientWidth=779
-ClientHeight=535
-LeftPanelSize=0
-LeftPanelClients=DockSite1
-LeftPanelData=000004000100000009000000446F636B5369746531000000000000000000000000000000000001000000000000000000000000FFFFFFFF
+Left=280
+Top=126
+Width=694
+Height=485
+MaxLeft=-1
+MaxTop=-1
+ClientWidth=686
+ClientHeight=451
+LeftPanelSize=140
+LeftPanelClients=CodeExplorer@EditWindow0
+LeftPanelData=000004000000000000000000000000000000000000000000000100000000000000000C000000436F64654578706C6F726572FFFFFFFF
 RightPanelSize=0
-BottomPanelSize=87
+BottomPanelSize=0
 BottomPanelClients=MessageView@EditWindow0
-BottomPanelData=00000400000000000B030000000000000257000000000000000100000000000000000000000001000000002303000000000000010000000023030000000000000100000000230300000000000001000000008F0200000000000001000000000B0300000B0000004D65737361676556696577FFFFFFFF
+BottomPanelData=00000400010000000B0000004D657373616765566965770000000000000000000000000000000000FFFFFFFF
 
 [View0]
-Module=P:\vista\tmg-cprs\CPRS-Chart\fNotes.pas
+Module=P:\vista\tmg-cprs\CPRS-Chart\CPRSChart.dpr
 CursorX=1
-CursorY=4512
-TopLine=4502
+CursorY=1
+TopLine=1
 LeftCol=1
 
 [View1]
-Module=P:\vista\tmg-cprs\CPRS-Chart\fFrame.pas
-CursorX=1
-CursorY=859
-TopLine=850
-LeftCol=1
-
-[View2]
-Module=P:\Vista\tmg-cprs\CPRS-Lib\ORSystem.pas
-CursorX=1
-CursorY=132
-TopLine=121
-LeftCol=1
-
-[View3]
-Module=C:\PROGRA~1\VISTA\BDK32\Source\wsockc.pas
-CursorX=39
-CursorY=1483
-TopLine=1468
-LeftCol=1
-
-[View4]
-Module=c:\program files\borland\delphi7\source\rtl\Sys\sysutils.pas
-CursorX=1
-CursorY=16069
-TopLine=16058
-LeftCol=1
-
-[View5]
-Module=P:\vista\tmg-cprs\CPRS-Chart\fxBroker.pas
-CursorX=1
-CursorY=128
-TopLine=121
-LeftCol=1
-
-[View6]
-Module=P:\vista\tmg-cprs\CPRS-Chart\Orders\fODBase.pas
-CursorX=75
-CursorY=1265
-TopLine=1254
-LeftCol=1
-
-[View7]
-Module=P:\vista\tmg-cprs\CPRS-Chart\fImages.pas
-CursorX=46
-CursorY=844
-TopLine=834
-LeftCol=1
-
-[View8]
-Module=P:\vista\tmg-cprs\CPRS-Lib\ORNet.pas
-CursorX=47
-CursorY=328
-TopLine=317
-LeftCol=1
-
-[View9]
 Module=P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\HTMLEdit\TMGHTML2.pas
-CursorX=1
-CursorY=189
-TopLine=178
+CursorX=13
+CursorY=894
+TopLine=882
 LeftCol=1
 
@@ -222,9 +90,6 @@
 
 [Watches]
-Count=4
-Watch0='CachedWPField',256,0,18,1,0,'Watches'
-Watch1='DataForGrid.indexof',256,0,18,1,0,'Watches'
-Watch2='E',256,0,18,1,0,'Watches'
-Watch3='MarkForDelete',256,0,18,1,0,'Watches'
+Count=1
+Watch0='frmPtSel',256,0,18,1,0,'Watches'
 
 [WatchWindow]
@@ -234,25 +99,26 @@
 Visible=1
 State=0
-Left=0
-Top=0
-Width=207
-Height=621
-MaxLeft=-1
-MaxTop=-1
-ClientWidth=207
-ClientHeight=621
-TBDockHeight=234
+Left=-785
+Top=535
+Width=750
+Height=229
+MaxLeft=-1
+MaxTop=-1
+ClientWidth=742
+ClientHeight=203
+TBDockHeight=57
 LRDockWidth=421
 Dockable=1
 
 [Breakpoints]
-Count=7
+Count=8
 Breakpoint0='P:\vista\tmg-cprs\CPRS-Chart\rCover.pas',315,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint1='P:\vista\tmg-cprs\TMG_Extra\HTMLEdit\TMGHTML2.pas',688,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint2='P:\vista\tmg-cprs\TMG_Extra\HTMLEdit\EmbeddedED\EmbeddedED.pas',1516,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint3='P:\vista\tmg-cprs\TMG_Extra\HTMLEdit\EmbeddedED\EmbeddedED.pas',1540,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint4='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDemoEdit.pas',1710,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint5='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDemoEdit.pas',1787,'',0,1,'',1,0,0,'',1,'','',''
-Breakpoint6='P:\vista\tmg-cprs\CPRS-Chart\fFrame.pas',858,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint1='P:\vista\tmg-cprs\TMG_Extra\HTMLEdit\EmbeddedED\EmbeddedED.pas',1516,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint2='P:\vista\tmg-cprs\TMG_Extra\HTMLEdit\EmbeddedED\EmbeddedED.pas',1540,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint3='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDemoEdit.pas',1710,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint4='P:\vista\tmg-cprs\CPRS-Chart\TMG_Extra\fPtDemoEdit.pas',1787,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint5='P:\vista\tmg-cprs\CPRS-Chart\fDrawers.pas',1068,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint6='P:\vista\tmg-cprs\CPRS-Chart\fPtSelOptns.pas',286,'',0,1,'',1,0,0,'',1,'','',''
+Breakpoint7='P:\vista\tmg-cprs\CPRS-Chart\Templates\uTemplateFields.pas',627,'',0,1,'',1,0,0,'',1,'','',''
 
 [AddressBreakpoints]
@@ -269,7 +135,7 @@
 MaxLeft=-4
 MaxTop=-4
-MaxWidth=808
+MaxWidth=1032
 MaxHeight=112
-ClientWidth=800
+ClientWidth=1024
 ClientHeight=78
 
@@ -310,6 +176,6 @@
 Visible=0
 State=0
-Left=220
-Top=110
+Left=0
+Top=39
 Width=800
 Height=561
@@ -353,5 +219,5 @@
 SplitPos=128
 ArrangeBy=Name
-SelectedItem=DragKind
+SelectedItem=
 ExpandedItems=Anchors,Options
 HiddenCategories=Legacy
@@ -361,6 +227,6 @@
 Visible=0
 State=0
-Left=31
-Top=201
+Left=-744
+Top=207
 Width=737
 Height=350
@@ -372,5 +238,5 @@
 LRDockWidth=737
 Dockable=1
-Column0Width=100
+Column0Width=178
 Column1Width=75
 Column2Width=200
@@ -383,6 +249,6 @@
 Visible=0
 State=0
-Left=592
-Top=324
+Left=363
+Top=83
 Width=420
 Height=412
@@ -544,11 +410,11 @@
 State=0
 Left=0
-Top=0
-Width=207
-Height=621
-MaxLeft=-1
-MaxTop=-1
-ClientWidth=207
-ClientHeight=621
+Top=12
+Width=140
+Height=439
+MaxLeft=-1
+MaxTop=-1
+ClientWidth=140
+ClientHeight=439
 TBDockHeight=305
 LRDockWidth=140
@@ -557,20 +423,20 @@
 [MessageView@EditWindow0]
 Create=1
-Visible=1
-State=0
-Left=12
-Top=0
-Width=767
-Height=87
-MaxLeft=-1
-MaxTop=-1
-ClientWidth=767
-ClientHeight=87
-TBDockHeight=87
+Visible=0
+State=0
+Left=-170
+Top=-513
+Width=443
+Height=85
+MaxLeft=-1
+MaxTop=-1
+ClientWidth=443
+ClientHeight=85
+TBDockHeight=85
 LRDockWidth=443
 Dockable=1
 
 [DockHosts]
-DockHostCount=2
+DockHostCount=1
 
 [DockSite0]
@@ -579,6 +445,6 @@
 Visible=1
 State=0
-Left=-783
-Top=268
+Left=12
+Top=118
 Width=342
 Height=482
@@ -594,22 +460,2 @@
 TabDockClients=PropertyInspector,ObjectTree
 
-[DockSite1]
-DockSiteType=1
-Create=1
-Visible=0
-State=0
-Left=0
-Top=12
-Width=215
-Height=650
-MaxLeft=-1
-MaxTop=-1
-ClientWidth=215
-ClientHeight=650
-TBDockHeight=94
-LRDockWidth=215
-Dockable=1
-TabPosition=0
-ActiveTab=Watch List
-TabDockClients=CodeExplorer@EditWindow0,WatchWindow
-
Index: cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart_TLB.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart_TLB.pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/CPRSChart_TLB.pas	(revision 654)
@@ -13,5 +13,5 @@
 
 // PASTLWTR : 1.2
-// File generated on 11/27/2009 5:46:58 PM from Type Library described below.
+// File generated on 12/28/2009 9:26:13 PM from Type Library described below.
 
 // ************************************************************************  //
Index: cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/HTMLEdit/TMGHTML2.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/HTMLEdit/TMGHTML2.pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/HTMLEdit/TMGHTML2.pas	(revision 654)
@@ -891,5 +891,5 @@
     KeyTime.HighPart := KeyPressTime.dwHighDateTime;
     Delta := floor( (NowTime2.QuadPart - KeyTime.QuadPart) / 100000);
-    Result := (Delta < 100);
+    Result := (Delta < 100) and (Delta > 0);
   end;
 
Index: cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/HTMLEdit/TMGHTML2.~pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/HTMLEdit/TMGHTML2.~pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/HTMLEdit/TMGHTML2.~pas	(revision 654)
@@ -655,22 +655,26 @@
 
 function THtmlObj.MoveCaretToEnd : boolean;
-//kt added        
+//kt added
 var //TextRange:IHtmlTxtRange;
     count : integer;
 begin
+  if not assigned (FTMGDisplayPointer) then begin
+    Result := false;
+    exit;
+  end;
   Result:=(S_OK = FTMGDisplayPointer.MoveUnit(DISPLAY_MOVEUNIT_BottomOfWindow,0));
   count := 0;
-  repeat   
+  repeat
     Result:=(S_OK = FTMGDisplayPointer.MoveUnit(DISPLAY_MOVEUNIT_NextLine,-1));
     inc (count);
   until (Result = false) or (count > 500);
-  Result:=(S_OK = FTMGDisplayPointer.MoveUnit(DISPLAY_MOVEUNIT_CurrentLineEnd,0));   
+  Result:=(S_OK = FTMGDisplayPointer.MoveUnit(DISPLAY_MOVEUNIT_CurrentLineEnd,0));
   Result:=(S_OK = FCaret.MoveCaretToPointer(FTMGDisplayPointer,
                                             integer(FALSE),
                                             CARET_DIRECTION_SAME));
   {
-  SendMessage(FmsHTMLwinHandle, WM_KEYDOWN, VK_END, 0); 
+  SendMessage(FmsHTMLwinHandle, WM_KEYDOWN, VK_END, 0);
   SendMessage(FmsHTMLwinHandle, WM_KEYUP, VK_END, 0);
-  SendMessage(FmsHTMLwinHandle, WM_KEYDOWN, VK_END, 0); 
+  SendMessage(FmsHTMLwinHandle, WM_KEYDOWN, VK_END, 0);
   SendMessage(FmsHTMLwinHandle, WM_KEYUP, VK_END, 0);
   }
Index: cprs/branches/tmg-cprs/CPRS-Chart/Templates/fTemplateDialog.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/Templates/fTemplateDialog.pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/Templates/fTemplateDialog.pas	(revision 654)
@@ -6,5 +6,5 @@
 uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
-  StdCtrls, ExtCtrls, ORCtrls, ORFn, AppEvnts, uTemplates, DKLang;
+  StdCtrls, StrUtils, ExtCtrls, ORCtrls, ORFn, AppEvnts, uTemplates, DKLang;
 
 type
@@ -44,4 +44,7 @@
     FCheck4Required: boolean;
     FSilent: boolean;
+    FHTMLMode : boolean; //kt added 12/28/09
+    FAnswerOpenTag : string; //kt added 12/28/09
+    FAnswerCloseTag : string; //kt added 12/28/09
     procedure SizeFormToCancelBtn();
     procedure ChkAll(Chk: boolean);
@@ -59,6 +62,10 @@
     procedure ParentCBEnter(Sender: TObject);
     procedure ParentCBExit(Sender: TObject);
+    procedure SetAnswerHTMLTag(Value : string); //kt 12/28/09
   public
     property Silent: boolean read FSilent write FSilent ;
+    property HTMLMode : boolean read FHTMLMode write FHTMLMode; //kt added 12/28/09
+    property HTMLAnswerOpenTag : string read FAnswerOpenTag write SetAnswerHTMLTag;  //kt added 12/28/09
+    property HTMLAnswerCloseTag : string read FAnswerCloseTag write SetAnswerHTMLTag;  //kt added 12/28/09
   published
   end;
@@ -66,4 +73,6 @@
 // Returns True if Cancel button is pressed
 function DoTemplateDialog(SL: TStrings; const CaptionText: string; PreviewMode: boolean = FALSE): boolean;
+function RemoveHTMLTags(Txt : string) : string;
+function FormatHTMLTags(Txt : string): string;
 procedure CheckBoilerplate4Fields(SL: TStrings; const CaptionText: string = ''; PreviewMode: boolean = FALSE); overload;
 procedure CheckBoilerplate4Fields(var AText: string; const CaptionText: string = ''; PreviewMode: boolean = FALSE); overload;
@@ -81,4 +90,8 @@
   Gap = 4;
   IndentGap = 18;
+  HTMLBEGINNINGTAG = '{HTML:';   //kt
+  HTMLENDINGTAG = '}';       //kt
+  HTMLBEGINNINGTAGLEN = length(HTMLBEGINNINGTAG);  //kt
+  HTMLENDINGTAGLEN = length(HTMLENDINGTAG);   //kt
 
 
@@ -89,9 +102,14 @@
   Save, Hidden: boolean;
   TmpCtrl: TStringList;
-
+  HTMLMode : boolean; //kt added 12/28/09
+  HTMLOpenTag,HTMLCloseTag : string; //kt added 12/28/09
 begin
   Txt := SL.Text;
   SL.Clear;
   TmpCtrl := TStringList.Create;
+  HTMLMode := frmTemplateDialog.HTMLMode; //kt added 12/28/09
+  HTMLOpenTag := frmTemplateDialog.HTMLAnswerOpenTag;  //kt added 12/28/09
+  HTMLCloseTag := frmTemplateDialog.HTMLAnswerCloseTag; //kt added 12/28/09
+  //kt added 12/28/09
   try
     for i := 0 to frmTemplateDialog.sbMain.ControlCount-1 do
@@ -117,5 +135,7 @@
         p2 := StrToInt(Piece(tmp,'~',2));
         Hidden := (copy(Piece(tmp,'~',3),2,1)=BOOLCHAR[TRUE]);
-        SL.Text := SL.Text + ResolveTemplateFields(Copy(Txt,p1,p2), FALSE, Hidden, IncludeEmbeddedFields);
+        //kt original line 12/28/09 --> SL.Text := SL.Text + ResolveTemplateFields(Copy(Txt,p1,p2), FALSE, Hidden, IncludeEmbeddedFields);
+        SL.Text := SL.Text + ResolveTemplateFields(Copy(Txt,p1,p2), FALSE, Hidden, IncludeEmbeddedFields,
+                                                   HTMLMode, HTMLOpenTag, HTMLCloseTag );
       end;
     end;
@@ -195,4 +215,7 @@
     DlgIDCounts.Duplicates := dupError;
     frmTemplateDialog.Caption := CaptionText;
+    frmTemplateDialog.HTMLMode := uTemplates.bUsingHTMLMode; //kt
+    frmTemplateDialog.HTMLAnswerOpenTag := '<I>'; //kt 12/28/09
+    //SL.Text := RemoveHTMLTags(SL.Text);  //elh
     AssignFieldIDs(SL);
     frmTemplateDialog.SL := SL;
@@ -237,9 +260,14 @@
       end;
       frmTemplateDialog.BuildAllControls;
-      repeat                      
+      repeat
          frmTemplateDialog.ShowModal;
-         if(frmTemplateDialog.ModalResult = mrOK) then
-           GetText(SL, TRUE)     {TRUE = Include embedded fields}
-         else
+         if(frmTemplateDialog.ModalResult = mrOK) then begin
+           GetText(SL, TRUE);     {TRUE = Include embedded fields}
+           if uTemplates.bUsingHTMLMode then begin
+              SL.Text := FormatHTMLTags(SL.Text);
+           end else begin
+              SL.Text := RemoveHTMLTags(SL.Text);
+           end;
+         end else begin
           if (not PreviewMode) and (not frmTemplateDialog.Silent) and (not uInit.TimedOut) then
             begin
@@ -262,4 +290,5 @@
               CancelDlg := TRUE;
             end;
+         end;      
       until CancelDlg or (frmTemplateDialog.ModalResult = mrOK)
     end
@@ -281,4 +310,53 @@
 end;
 
+function RemoveHTMLTags(Txt : string): string;
+var
+  beginning,ending : integer;
+  tempString,tempResult : string;
+begin
+  tempString := Txt;
+  //here we will strip out all HTML formatting tags  //elh
+  beginning := pos(HTMLBEGINNINGTAG, tempString);
+  if beginning = 0 then begin
+     Result := Txt;
+  end else begin
+    while beginning > 0 do
+    begin
+      tempResult := tempResult + Leftstr(tempString,beginning-1);
+      tempString := Rightstr(tempString,length(tempString)-beginning-HTMLBEGINNINGTAGLEN);
+      ending := pos(HTMLENDINGTAG, tempString);
+      tempString := Rightstr(tempString,length(tempString)-ending);
+      beginning := pos(HTMLBEGINNINGTAG, tempString);
+  //    tempString := Midstr(Txt,i,HTMLBEGINNINGTAGLEN);
+    end;
+    Result := tempResult + tempString;
+  end;
+end;
+
+function FormatHTMLTags(Txt : string): string;
+var
+  beginning,ending : integer;
+  tempString,tempResult : string;
+begin
+  tempString := Txt;
+  //here we will strip out all HTML formatting tags  //elh
+  beginning := pos(HTMLBEGINNINGTAG, tempString);
+  if beginning = 0 then begin
+     Result := Txt;
+  end else begin
+    while beginning > 0 do
+    begin
+      tempResult := tempResult + Leftstr(tempString,beginning-1);
+      tempString := Rightstr(tempString,length(tempString)-beginning-HTMLBEGINNINGTAGLEN+1);
+      ending := pos(HTMLENDINGTAG, tempString);
+      tempResult := tempResult + Leftstr(tempString,ending-1);
+      tempString := Rightstr(tempString,length(tempString)-ending);
+      beginning := pos(HTMLBEGINNINGTAG, tempString);
+  //    tempString := Midstr(Txt,i,HTMLBEGINNINGTAGLEN);
+    end;
+    Result := tempResult + tempString;
+  end;
+end;
+
 procedure CheckBoilerplate4Fields(SL: TStrings; const CaptionText: string = ''; PreviewMode: boolean = FALSE);
 begin
@@ -307,4 +385,19 @@
   finally
     tmp.free;
+  end;
+end;
+
+procedure TfrmTemplateDialog.SetAnswerHTMLTag(Value : string);
+//kt 12/28/09 Added entire function
+begin
+  if Value='' then begin
+    FAnswerOpenTag :='';
+    FAnswerCloseTag := '';
+  end else begin
+    if Pos('<',Value)>0 then Value := Piece(Value,'<',2);
+    if Pos('>',Value)>0 then Value := Piece(Value,'>',1);
+    if Pos('/',Value)>0 then Value := Piece(Value,'/',2);
+    FAnswerOpenTag :='<'+Value+'>';
+    FAnswerCloseTag := '</' + Value + '>';
   end;
 end;
@@ -460,4 +553,5 @@
   end;
   tmp := copy(SL.Text, p1, p2);
+  tmp := RemoveHTMLTags(tmp);
   if(copy(tmp, length(tmp)-1, 2) = CRLF) then
     delete(tmp, length(tmp)-1, 2);
@@ -637,4 +731,5 @@
 procedure TfrmTemplateDialog.FormCreate(Sender: TObject);
 begin
+  FHTMLMode := false; //kt added 12/28/09
   BuildIdx := TStringList.Create;
   Entries := TStringList.Create;
Index: cprs/branches/tmg-cprs/CPRS-Chart/Templates/uTemplateFields.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/Templates/uTemplateFields.pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/Templates/uTemplateFields.pas	(revision 654)
@@ -44,8 +44,13 @@
     FPanelDying: boolean;
     FOnDestroy: TNotifyEvent;
+    FHTMLMode : boolean; //kt added 12/28/09
+    FAnswerOpenTag : string; //kt added 12/28/09
+    FAnswerCloseTag : string; //kt added 12/28/09
     procedure KillLabels;
     function GetFieldValues: string;
     procedure SetFieldValues(const Value: string);
     procedure SetAutoDestroyOnPanelFree(const Value: boolean);
+    procedure SetAnswerHTMLTag(Value : string); //kt 12/28/09
+
   protected
     procedure UpDownChange(Sender: TObject);
@@ -67,4 +72,6 @@
     property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
     property FieldValues: string read GetFieldValues write SetFieldValues;
+    property HTMLMode : boolean read FHTMLMode write FHTMLMode; //kt added 12/28/09
+    property AnswerHTMLTag : string read FAnswerOpenTag write SetAnswerHTMLTag;  //kt added 12/28/09
     property AutoDestroyOnPanelFree: boolean read FAutoDestroyOnPanelFree
                                              write SetAutoDestroyOnPanelFree;
@@ -161,5 +168,13 @@
 procedure AssignFieldIDs(var Txt: string); overload;
 procedure AssignFieldIDs(SL: TStrings); overload;
-function ResolveTemplateFields(Text: string; AutoWrap: boolean; Hidden: boolean = FALSE; IncludeEmbedded: boolean = FALSE): string;
+//kt 12/28/09 originial --> function ResolveTemplateFields(Text: string; AutoWrap: boolean; Hidden: boolean = FALSE; IncludeEmbedded: boolean = FALSE): string;
+function ResolveTemplateFields(Text: string;
+                               AutoWrap: boolean;
+                               Hidden: boolean = FALSE;
+                               IncludeEmbedded: boolean = FALSE;
+                               HTMLMode : boolean = FALSE; //kt added 12/28/09
+                               HTMLAnswerOpenTag : string = ''; //kt added 12/28/09
+                               HTMLAnswerCloseTag : string = '' //kt added 12/28/09
+                               ): string;
 function AreTemplateFieldsRequired(const Text: string; FldValues: TORStringList =  nil): boolean;
 function HasTemplateField(txt: string): boolean;
@@ -179,4 +194,8 @@
   TemplateFieldBeginSignature = '{FLD:';
   TemplateFieldEndSignature = '}';
+  HTMLBEGINNINGTAG = '{HTML:';
+  HTMLENDINGTAG = '}';
+  HTMLBEGINNINGTAGLEN = length(HTMLBEGINNINGTAG);
+  HTMLENDINGTAGLEN = length(HTMLENDINGTAG);
   //MissingFieldsTxt = 'One or more required fields must still be entered.';  <-- original line.  //kt 8/8/2007
   function MissingFieldsTxt : string;  //kt added
@@ -519,5 +538,9 @@
                                AutoWrap: boolean;
                                Hidden: boolean = FALSE;
-                               IncludeEmbedded: boolean = FALSE): string;
+                               IncludeEmbedded: boolean = FALSE;
+                               HTMLMode : boolean = FALSE; //kt added 12/28/09
+                               HTMLAnswerOpenTag : string = ''; //kt added 12/28/09
+                               HTMLAnswerCloseTag : string = '' //kt added 12/28/09
+                               ): string;
 var
   flen, CtrlID, i, j: integer;
@@ -526,4 +549,5 @@
   FoundEntry: boolean;
   TmplFld: TTemplateField;
+  tempSL : TStringList;
 
   procedure AddNewTxt;
@@ -584,4 +608,9 @@
             if (assigned(TmplFld)) and (TmplFld.DateType in DateComboTypes) then {if this is a TORDateBox}
                NewTxt := Piece(NewTxt,':',1);          {we only want the first piece of NewTxt}
+            //kt 12/28/09 --- Start mod to wrap answers in custom HTML tag ---
+            if (HTMLMode=true) and (NewTxt <> '') then begin
+              NewTxt := HTMLAnswerOpenTag + NewTxt + HTMLAnswerCloseTag;   //kt 12/29/09
+            end;
+            //kt --- End mod to wrap answers in custom HTML tag ---
             AddNewTxt;
           end;
@@ -594,8 +623,18 @@
         end;
       end;
+    end else begin
+      if HTMLMode=true then begin
+        tempSL := TStringList.create;
+        tempSL.Text := Result;
+        if tempSL.Count < 3 then begin
+          Result := HTMLAnswerOpenTag + Result + HTMLAnswerCloseTag;
+        end;
+        tempSL.Free;
+      end;
     end;
   until(i = 0);
   if not AutoWrap then
     WordWrapText(Result);
+
 end;
 
@@ -1801,4 +1840,5 @@
   FID := AID;
   FText := Text;
+  FHTMLMode := false; //kt added 12/28/09
   FControls := TStringList.Create;
   FIndents := TStringList.Create;
@@ -2223,7 +2263,22 @@
 end;
 
+procedure TTemplateDialogEntry.SetAnswerHTMLTag(Value : string);
+//kt 12/28/09 Added entire function
+begin
+  if Value='' then begin
+    FAnswerOpenTag :='';
+    FAnswerCloseTag := '';
+  end else begin
+    if Pos('<',Value)>0 then Value := Piece(Value,'<',2);
+    if Pos('>',Value)>0 then Value := Piece(Value,'>',1);
+    FAnswerOpenTag :='<'+Value+'>';
+    FAnswerCloseTag := '</' + Value + '>';
+  end;
+end;
+
 function TTemplateDialogEntry.GetText: string;
 begin
-  Result := ResolveTemplateFields(FText, FALSE);
+  //kt Result := ResolveTemplateFields(FText, FALSE);
+  Result := ResolveTemplateFields(FText, FALSE, FALSE, FALSE, FHTMLMode, FAnswerOpenTag, FAnswerCloseTag); //kt 12/29/09
 end;
 
Index: cprs/branches/tmg-cprs/CPRS-Chart/Templates/uTemplates.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/Templates/uTemplates.pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/Templates/uTemplates.pas	(revision 654)
@@ -1886,5 +1886,5 @@
   Itm: string;
 begin
-  Result := GetBoilerplate;
+  Result := GetBoilerplate; //ELH
   if FIsReminderDialog or FIsCOMObject then exit;
   Itm := ItemBoilerplate;
@@ -1952,5 +1952,5 @@
           TmpSL.Text := rHTMLTools.Text2HTML(TmpSL);                //kt 8/09
         end;                                                        //kt 8/09
-        bUsingHTMLMode := false; //force reset each call.           //kt 8/09
+        //kt 12/28/09   bUsingHTMLMode := false; //force reset each call.           //kt 8/09
       end;                                                          //kt 8/09
       Result := TmpSL.Text;
Index: cprs/branches/tmg-cprs/CPRS-Chart/fDrawers.dfm
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fDrawers.dfm	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fDrawers.dfm	(revision 654)
@@ -1,5 +1,5 @@
 object frmDrawers: TfrmDrawers
-  Left = 634
-  Top = 437
+  Left = 624
+  Top = 346
   BorderStyle = bsNone
   Caption = 'frmDrawers'
Index: cprs/branches/tmg-cprs/CPRS-Chart/fDrawers.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fDrawers.pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fDrawers.pas	(revision 654)
@@ -977,18 +977,17 @@
   if (dmodShared.TemplateOK(tvTemplates.Selected.Data)) then begin  //kt
     Template := TTemplate(tvTemplates.Selected.Data);
-    TemplateIsHTML := rHTMLTools.IsHTML(Template.Text); //kt
-    if not InsertOK(TRUE,TemplateIsHTML) then exit;  //kt
     Template.TemplatePreviewMode := FALSE;
-    if Template.IsReminderDialog then
+    if Template.IsReminderDialog then begin
       Template.ExecuteReminderDialog(TForm(Owner))
-    else
-    begin
+    end else begin
       if Template.IsCOMObject then
         txt := Template.COMObjectText('', DocInfo)
-      else
+      else begin
         uTemplates.bUsingHTMLMode := HTMLEditActive; //kt 8/09  Will be used in TTemplate.GetText
         txt := Template.Text;
-      if(txt <> '') then
-      begin
+        TemplateIsHTML := rHTMLTools.IsHTML(txt); //kt
+        if not InsertOK(FALSE,TemplateIsHTML) then exit;  //kt
+      end;
+      if(txt <> '') then begin
 //      CheckBoilerplate4Fields(txt, 'Template: ' + Template.PrintName);  <-- original line.  //kt 7/15/2007
         CheckBoilerplate4Fields(txt, DKLangConstW('fDrawers_Templatex') + Template.PrintName); //kt added 7/15/2007
Index: cprs/branches/tmg-cprs/CPRS-Chart/fPtSel.dfm
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fPtSel.dfm	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fPtSel.dfm	(revision 654)
@@ -1,7 +1,7 @@
 object frmPtSel: TfrmPtSel
-  Left = 184
-  Top = 115
+  Left = 248
+  Top = 152
   Width = 793
-  Height = 589
+  Height = 587
   BorderIcons = []
   Caption = 'Patient Selection'
@@ -169,5 +169,5 @@
   object pnlNotifications: TORAutoPanel
     Left = 0
-    Top = 520
+    Top = 518
     Width = 785
     Height = 35
@@ -229,5 +229,5 @@
     Top = 311
     Width = 785
-    Height = 209
+    Height = 207
     Align = alClient
     Columns = <
Index: cprs/branches/tmg-cprs/CPRS-Chart/fPtSelOptns.dfm
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fPtSelOptns.dfm	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fPtSelOptns.dfm	(revision 654)
@@ -1,5 +1,5 @@
 object frmPtSelOptns: TfrmPtSelOptns
-  Left = 587
-  Top = 199
+  Left = 436
+  Top = 128
   BorderStyle = bsNone
   Caption = 'frmPtSelOptns'
Index: cprs/branches/tmg-cprs/CPRS-Chart/fPtSelOptns.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/fPtSelOptns.pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/fPtSelOptns.pas	(revision 654)
@@ -225,8 +225,8 @@
 { called by radTeams, radSpecialties, radWards - shows items for the list source }
 begin
+(*     Commented out until a further clarification    //kt  12/29/09
     //vwpt remove other radio button selections
-// if frmPtSel.radiogroup1.index <> 0 then   //kt
- if frmPtSel.RadioGroup1.ItemIndex <> 0 then
- begin
+ if assigned(frmPtSel) and (frmPtSel.radiogroup1.ItemIndex <> 0) then   //kt
+ begin      //elh
       FSrcType := TControl(Sender).Tag;
       case FSrcType of
@@ -257,4 +257,5 @@
  begin
   //end vwpt
+  *)
   cboList.Pieces := '2';
   FSrcType := TControl(Sender).Tag;
@@ -275,5 +276,5 @@
   end;
   cboList.Caption := TRadioButton(Sender).Caption;
- end; //else
+ //kt end; //else
 end;
 
@@ -282,5 +283,5 @@
 begin
   //vwpt remove other radio button selections
- // if fPtSel.radiogrp1index <> 0 then //kt
+ (*     Commented out until a further clarification    //kt  12/29/09
  if frmPtSel.RadioGroup1.ItemIndex <> 0 then
  begin
@@ -306,5 +307,5 @@
  else
  begin
-  //end vwpt
+  //end vwpt  *)
   cboList.Pieces := '2';
   FSrcType := TControl(Sender).Tag;
@@ -331,5 +332,5 @@
   end;
   cboList.Caption := TRadioButton(Sender).Caption;
- end; //else
+ //kt end; //else
 end;
 
Index: cprs/branches/tmg-cprs/CPRS-Chart/uReminders.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/uReminders.pas	(revision 612)
+++ cprs/branches/tmg-cprs/CPRS-Chart/uReminders.pas	(revision 654)
@@ -4579,6 +4579,8 @@
   txt: string;
   FldData: TORStringList;
-
-begin
+  HTMLMode : boolean; //kt added 12/28/09
+
+begin
+  HTMLMode := false; //kt added 12/28/09  NOTE: Later can figure out if/when appropriate to set this to true, and how to toggle.
   if (not (FReminder is TReminder)) then
     ScootOver := 4;
@@ -4596,5 +4598,6 @@
           //values from the visual control in the dialog window.
           if FReminder = CurrentReminderInDialog then
-             txt := ResolveTemplateFields(txt, TRUE)
+             //kt txt := ResolveTemplateFields(txt, TRUE)
+             txt := ResolveTemplateFields(txt, TRUE, FALSE, FALSE, HTMLMode, '', '')  //kt 12/28/09
           else
           //If this is not the CurrentReminderInDialog (i.e.: Next or Back button
