Index: cprs/branches/GUI-config/DebugU.dfm
===================================================================
--- cprs/branches/GUI-config/DebugU.dfm	(revision 488)
+++ cprs/branches/GUI-config/DebugU.dfm	(revision 488)
@@ -0,0 +1,78 @@
+object DebugForm: TDebugForm
+  Left = 6
+  Top = 2
+  Width = 518
+  Height = 488
+  Caption = 'Message Log'
+  Color = clBtnFace
+  Font.Charset = DEFAULT_CHARSET
+  Font.Color = clWindowText
+  Font.Height = -11
+  Font.Name = 'MS Sans Serif'
+  Font.Style = []
+  OldCreateOrder = False
+  Visible = True
+  PixelsPerInch = 96
+  TextHeight = 13
+  object Memo: TMemo
+    Left = 0
+    Top = 33
+    Width = 510
+    Height = 380
+    Align = alClient
+    ScrollBars = ssBoth
+    TabOrder = 0
+  end
+  object Panel1: TPanel
+    Left = 0
+    Top = 0
+    Width = 510
+    Height = 33
+    Align = alTop
+    TabOrder = 1
+    object Label1: TLabel
+      Left = 10
+      Top = 7
+      Width = 82
+      Height = 19
+      Caption = 'Message Log'
+      Font.Charset = ANSI_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Times New Roman'
+      Font.Style = []
+      ParentFont = False
+    end
+  end
+  object Panel2: TPanel
+    Left = 0
+    Top = 413
+    Width = 510
+    Height = 41
+    Align = alBottom
+    TabOrder = 2
+    DesignSize = (
+      510
+      41)
+    object btnHide: TButton
+      Left = 422
+      Top = 8
+      Width = 75
+      Height = 25
+      Anchors = [akRight, akBottom]
+      Caption = '&Hide'
+      TabOrder = 0
+      OnClick = btnHideClick
+    end
+    object btnClear: TButton
+      Left = 334
+      Top = 8
+      Width = 75
+      Height = 25
+      Anchors = [akRight, akBottom]
+      Caption = '&Clear'
+      TabOrder = 1
+      OnClick = btnClearClick
+    end
+  end
+end
Index: cprs/branches/GUI-config/DebugU.pas
===================================================================
--- cprs/branches/GUI-config/DebugU.pas	(revision 488)
+++ cprs/branches/GUI-config/DebugU.pas	(revision 488)
@@ -0,0 +1,43 @@
+unit DebugU;
+
+interface
+
+uses
+  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+  Dialogs, StdCtrls, ExtCtrls;
+
+type
+  TDebugForm = class(TForm)
+    Memo: TMemo;
+    Panel1: TPanel;
+    Panel2: TPanel;
+    Label1: TLabel;
+    btnHide: TButton;
+    btnClear: TButton;
+    procedure btnClearClick(Sender: TObject);
+    procedure btnHideClick(Sender: TObject);
+  private
+    { Private declarations }
+  public
+    { Public declarations }
+  end;
+
+var
+  DebugForm: TDebugForm;
+
+implementation
+
+{$R *.dfm}
+
+procedure TDebugForm.btnClearClick(Sender: TObject);
+begin
+  Memo.Lines.Clear;
+end;
+
+procedure TDebugForm.btnHideClick(Sender: TObject);
+begin
+  DebugForm.Hide;
+end;
+
+end.
+
Index: cprs/branches/GUI-config/GUI_Config.dof
===================================================================
--- cprs/branches/GUI-config/GUI_Config.dof	(revision 484)
+++ cprs/branches/GUI-config/GUI_Config.dof	(revision 488)
@@ -101,5 +101,5 @@
 UsePackages=0
 [Parameters]
-RunParams=s=192.168.3.111 p=9230
+RunParams=s=192.168.3.111 p=9230 debug=enable
 HostApplication=
 Launcher=
Index: cprs/branches/GUI-config/GUI_Config.dpr
===================================================================
--- cprs/branches/GUI-config/GUI_Config.dpr	(revision 484)
+++ cprs/branches/GUI-config/GUI_Config.dpr	(revision 488)
@@ -42,5 +42,6 @@
   CreateTemplateU in 'CreateTemplateU.pas' {CreateTemplateForm},
   SkinFormU in 'SkinFormU.pas' {SkinForm},
-  BatchAddU in 'BatchAddU.pas' {BatchAddForm};
+  BatchAddU in 'BatchAddU.pas' {BatchAddForm},
+  DebugU in 'DebugU.pas' {DebugForm};
 
 {$R *.res}
@@ -62,4 +63,5 @@
   Application.CreateForm(TCreateTemplateForm, CreateTemplateForm);
   Application.CreateForm(TBatchAddForm, BatchAddForm);
+  Application.CreateForm(TDebugForm, DebugForm);
   MainForm.Initialize;
   Application.Run;
Index: cprs/branches/GUI-config/GUI_Config.dsk
===================================================================
--- cprs/branches/GUI-config/GUI_Config.dsk	(revision 484)
+++ cprs/branches/GUI-config/GUI_Config.dsk	(revision 488)
@@ -1,22 +1,25 @@
 [Closed Files]
-File_0=SourceModule,'P:\Vista\GUI-config\SkinStuff\ipSkinManager.dcu',0,1,1,11,5,0,0
-File_1=SourceModule,'P:\Vista\GUI-config\PostU.pas',0,1,162,47,166,0,0
-File_2=SourceModule,'P:\Vista\GUI-config\SelDateTimeU.pas',0,1,1,1,5,0,0
-File_3=SourceModule,'C:\Program Files\Borland\Delphi7\Projects\Vista\CPRS-Lib\ORFn.pas',0,1,610,1,621,0,0
-File_4=SourceModule,'C:\Program Files\Borland\Delphi7\Projects\Vista\CPRS-Lib\ORCtrls.pas',0,1,1171,1,1182,0,0
-File_5=SourceModule,'c:\program files\borland\delphi7\projects\vista\cprs-1.0.23.15\broker\source\Trpcb.pas',0,1,1013,1,1021,0,0
-File_6=SourceModule,'C:\Program Files\Borland\Delphi7\Projects\Vista\CPRS-Lib\ORNet.pas',0,1,53,1,65,0,0
+File_0=SourceModule,'P:\Vista\GUI-config\MainU.dfm',0,1,1,1,1,0,0
+File_1=SourceModule,'P:\Vista\GUI-config\SkinStuff\ipSkinManager.dcu',0,1,1,11,5,0,0
+File_2=SourceModule,'P:\Vista\GUI-config\PostU.pas',0,1,162,47,166,0,0
+File_3=SourceModule,'P:\Vista\GUI-config\SelDateTimeU.pas',0,1,1,1,5,0,0
+File_4=SourceModule,'C:\Program Files\Borland\Delphi7\Projects\Vista\CPRS-Lib\ORFn.pas',0,1,610,1,621,0,0
+File_5=SourceModule,'C:\Program Files\Borland\Delphi7\Projects\Vista\CPRS-Lib\ORCtrls.pas',0,1,1171,1,1182,0,0
+File_6=SourceModule,'c:\program files\borland\delphi7\projects\vista\cprs-1.0.23.15\broker\source\Trpcb.pas',0,1,1013,1,1021,0,0
+File_7=SourceModule,'C:\Program Files\Borland\Delphi7\Projects\Vista\CPRS-Lib\ORNet.pas',0,1,53,1,65,0,0
 
 [Modules]
 Module0=P:\Vista\GUI-config\MainU.pas
-Module1=P:\Vista\GUI-config\GUI_Config.dpr
-Module2=P:\Vista\GUI-config\SkinFormU.pas
-Module3=P:\Vista\GUI-config\LookupU.pas
-Module4=P:\Vista\GUI-config\CPRS-Lib\ORCtrls.pas
-Module5=P:\Vista\GUI-config\BatchAddU.pas
-Module6=P:\Vista\GUI-config\SubfilesU.pas
+Module1=P:\vista\GUI-config\DebugU.pas
+Module2=P:\Vista\GUI-config\GUI_Config.dpr
+Module3=P:\Vista\GUI-config\CPRS-Lib\ORCtrls.pas
+Module4=P:\Vista\GUI-config\SkinFormU.pas
+Module5=P:\Vista\GUI-config\SubfilesU.pas
+Module6=P:\Vista\GUI-config\BatchAddU.pas
 Module7=P:\Vista\GUI-config\frmSplash.pas
-Module8=c:\program files\borland\delphi7\source\vcl\OleCtrls.pas
-Count=9
+Module8=c:\program files\borland\delphi7\source\rtl\Win\ShellAPI.pas
+Module9=c:\program files\borland\delphi7\source\vcl\OleCtrls.pas
+Module10=P:\Vista\GUI-config\LookupU.pas
+Count=11
 EditWindowCount=1
 
@@ -26,4 +29,9 @@
 FormOnTop=0
 
+[P:\vista\GUI-config\DebugU.pas]
+ModuleType=SourceModule
+FormState=1
+FormOnTop=0
+
 [P:\Vista\GUI-config\GUI_Config.dpr]
 ModuleType=SourceModule
@@ -31,4 +39,9 @@
 FormOnTop=0
 
+[P:\Vista\GUI-config\CPRS-Lib\ORCtrls.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
 [P:\Vista\GUI-config\SkinFormU.pas]
 ModuleType=SourceModule
@@ -36,4 +49,29 @@
 FormOnTop=0
 
+[P:\Vista\GUI-config\SubfilesU.pas]
+ModuleType=SourceModule
+FormState=1
+FormOnTop=0
+
+[P:\Vista\GUI-config\BatchAddU.pas]
+ModuleType=SourceModule
+FormState=1
+FormOnTop=0
+
+[P:\Vista\GUI-config\frmSplash.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[c:\program files\borland\delphi7\source\rtl\Win\ShellAPI.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
+[c:\program files\borland\delphi7\source\vcl\OleCtrls.pas]
+ModuleType=SourceModule
+FormState=0
+FormOnTop=0
+
 [P:\Vista\GUI-config\LookupU.pas]
 ModuleType=SourceModule
@@ -41,29 +79,4 @@
 FormOnTop=0
 
-[P:\Vista\GUI-config\CPRS-Lib\ORCtrls.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[P:\Vista\GUI-config\BatchAddU.pas]
-ModuleType=SourceModule
-FormState=1
-FormOnTop=0
-
-[P:\Vista\GUI-config\SubfilesU.pas]
-ModuleType=SourceModule
-FormState=1
-FormOnTop=0
-
-[P:\Vista\GUI-config\frmSplash.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
-[c:\program files\borland\delphi7\source\vcl\OleCtrls.pas]
-ModuleType=SourceModule
-FormState=0
-FormOnTop=0
-
 [C:\Program Files\Borland\Delphi7\Projects\ProjectGroup1.bpg]
 FormState=0
@@ -71,5 +84,5 @@
 
 [EditWindow0]
-ViewCount=9
+ViewCount=11
 CurrentView=0
 View0=0
@@ -82,4 +95,6 @@
 View7=7
 View8=8
+View9=9
+View10=10
 CodeExplorer=CodeExplorer@EditWindow0
 MessageView=MessageView@EditWindow0
@@ -101,21 +116,28 @@
 BottomPanelSize=205
 BottomPanelClients=WatchWindow,MessageView@EditWindow0
-BottomPanelData=00000400010000000B0000004D65737361676556696577000300000000000002CD0000000000000001000000008B010000000000000100000001580300000000000002000000006C000000000000000200000002BE0000000000000003000000000000000000000000030000000000000000000000000300000000AC0100000000000003000000005803000000000000030000000058030000000000000300000000580300000000000003000000005803000000000000030000000058030000000000000200000000D80000000000000001000000005803000000000000010000000058030000000000000100000000AC0100000000000001000000005803000000000000010000000058030000000000000100000000AC010000000000000100000000C401000000000000010000000066000000000000000100000000D7020000000000000100000000160300000000000001000000001603000000000000010000000016030000000000000100000000160300000000000001000000008B0100000000000001000000008B0100000000000001000000008B010000000000000100000000F8020000000000000100000000FD02000000000000010000000016030000000000000100000000160300000000000001000000007E010000000000000100000000000300000B000000576174636857696E646F770100000000000300000B0000004D65737361676556696577FFFFFFFF
+BottomPanelData=00000400010000000B000000576174636857696E646F77000300000000000002CD0000000000000001000000008B010000000000000100000001580300000000000002000000006C000000000000000200000002BE0000000000000003000000000000000000000000030000000000000000000000000300000000AC0100000000000003000000005803000000000000030000000058030000000000000300000000580300000000000003000000005803000000000000030000000058030000000000000200000000D80000000000000001000000005803000000000000010000000058030000000000000100000000AC0100000000000001000000005803000000000000010000000058030000000000000100000000AC010000000000000100000000C401000000000000010000000066000000000000000100000000D7020000000000000100000000160300000000000001000000001603000000000000010000000016030000000000000100000000160300000000000001000000008B0100000000000001000000008B0100000000000001000000008B010000000000000100000000F8020000000000000100000000FD02000000000000010000000016030000000000000100000000160300000000000001000000007E01000000000000010000000100030000000000000200000000CD0000000B0000004D657373616765566965770200000000CD0000000000000001000000000003000000000000FFFFFFFF
 
 [View0]
 Module=P:\Vista\GUI-config\MainU.pas
-CursorX=1
-CursorY=1872
-TopLine=1869
+CursorX=3
+CursorY=33
+TopLine=25
 LeftCol=1
 
 [View1]
+Module=P:\vista\GUI-config\DebugU.pas
+CursorX=13
+CursorY=13
+TopLine=1
+LeftCol=1
+
+[View2]
 Module=P:\Vista\GUI-config\CPRS-Lib\ORCtrls.pas
 CursorX=1
-CursorY=3981
-TopLine=3973
-LeftCol=1
-
-[View2]
+CursorY=1
+TopLine=1
+LeftCol=1
+
+[View3]
 Module=P:\Vista\GUI-config\LookupU.pas
 CursorX=11
@@ -124,5 +146,5 @@
 LeftCol=1
 
-[View3]
+[View4]
 Module=c:\program files\borland\delphi7\source\vcl\OleCtrls.pas
 CursorX=12
@@ -131,5 +153,5 @@
 LeftCol=1
 
-[View4]
+[View5]
 Module=P:\Vista\GUI-config\SubfilesU.pas
 CursorX=5
@@ -138,19 +160,26 @@
 LeftCol=1
 
-[View5]
+[View6]
 Module=P:\Vista\GUI-config\SkinFormU.pas
+CursorX=16
+CursorY=95
+TopLine=87
+LeftCol=1
+
+[View7]
+Module=c:\program files\borland\delphi7\source\rtl\Win\ShellAPI.pas
 CursorX=1
-CursorY=170
-TopLine=162
-LeftCol=1
-
-[View6]
+CursorY=1
+TopLine=1
+LeftCol=1
+
+[View8]
 Module=P:\Vista\GUI-config\GUI_Config.dpr
 CursorX=1
-CursorY=66
-TopLine=59
-LeftCol=1
-
-[View7]
+CursorY=68
+TopLine=60
+LeftCol=1
+
+[View9]
 Module=P:\Vista\GUI-config\frmSplash.pas
 CursorX=20
@@ -159,5 +188,5 @@
 LeftCol=1
 
-[View8]
+[View10]
 Module=P:\Vista\GUI-config\BatchAddU.pas
 CursorX=16
@@ -177,15 +206,15 @@
 WatchShowColumnHeaders=1
 Create=1
-Visible=1
+Visible=0
 State=0
 Left=12
-Top=0
+Top=102
 Width=756
-Height=205
+Height=103
 MaxLeft=-1
 MaxTop=-1
 ClientWidth=756
-ClientHeight=205
-TBDockHeight=205
+ClientHeight=103
+TBDockHeight=103
 LRDockWidth=421
 Dockable=1
@@ -290,5 +319,5 @@
 SplitPos=114
 ArrangeBy=Name
-SelectedItem=OnNeedData
+SelectedItem=Name
 ExpandedItems=Anchors,Options
 HiddenCategories=Legacy
@@ -494,15 +523,15 @@
 [MessageView@EditWindow0]
 Create=1
-Visible=0
-State=0
-Left=396
+Visible=1
+State=0
+Left=12
 Top=0
-Width=372
-Height=122
-MaxLeft=-1
-MaxTop=-1
-ClientWidth=372
-ClientHeight=122
-TBDockHeight=122
+Width=756
+Height=205
+MaxLeft=-1
+MaxTop=-1
+ClientWidth=756
+ClientHeight=205
+TBDockHeight=205
 LRDockWidth=443
 Dockable=1
Index: cprs/branches/GUI-config/MainU.dfm
===================================================================
--- cprs/branches/GUI-config/MainU.dfm	(revision 484)
+++ cprs/branches/GUI-config/MainU.dfm	(revision 488)
@@ -1241,5 +1241,5 @@
     Left = 496
     Top = 16
-    object File1: TMenuItem
+    object FileMenu: TMenuItem
       Caption = '&File'
       object AboutMenu: TMenuItem
@@ -1247,7 +1247,7 @@
         OnClick = AboutMenuClick
       end
-      object Exit1: TMenuItem
+      object ExitMenuItem: TMenuItem
         Caption = 'E&xit'
-        OnClick = Exit1Click
+        OnClick = ExitMenuItemClick
       end
     end
Index: cprs/branches/GUI-config/MainU.pas
===================================================================
--- cprs/branches/GUI-config/MainU.pas	(revision 484)
+++ cprs/branches/GUI-config/MainU.pas	(revision 488)
@@ -81,6 +81,6 @@
     BasicUsersGrid: TStringGrid;
     MainMenu: TMainMenu;
-    File1: TMenuItem;
-    Exit1: TMenuItem;
+    FileMenu: TMenuItem;
+    ExitMenuItem: TMenuItem;
     AboutMenu: TMenuItem;
     CloneBtn: TBitBtn;
@@ -148,5 +148,5 @@
     procedure btnUsersApplyClick(Sender: TObject);
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
-    procedure Exit1Click(Sender: TObject);
+    procedure ExitMenuItemClick(Sender: TObject);
     procedure UserPageControlDrawTab(Control: TCustomTabControl; TabIndex: Integer; const Rect: TRect; Active: Boolean);
     procedure AboutMenuClick(Sender: TObject);
@@ -207,4 +207,6 @@
     CachedWPField : TStringList;
     FVisibleGridIdx : integer;
+    procedure ShowDebugClick(Sender: TObject);    
+    function FindParam(Param : string) : string;
     function GetCurrentUserName : string;
     procedure SetCursorImage(Cursor : TCursor);
@@ -247,4 +249,5 @@
     CurrentUserName: string;
     LastSelTreeNode : TTreeNode;
+    DebugMode : boolean;
     function GetUserLine(CurrentUserData : TStringList; Grid : TStringGrid; ARow:integer) :integer;
     function GetLineInfo(Grid : TStringGrid; CurrentUserData : TStringList; ARow: integer) : tFileEntry;
@@ -280,5 +283,5 @@
   frmSplash, Trpcb  , LookupU, SubfilesU, SetSelU, SelDateTimeU, PostU,
   FMErrorU, AboutU, PleaseWaitU, EditTextU, CreateTemplateU, SkinFormU,
-  BatchAddU;
+  BatchAddU, DebugU;
 
 {$R *.dfm}
@@ -289,5 +292,14 @@
   var tempMenu,tempSubMenu : TMenuItem;    
   begin
+    DebugMode := (FindParam('debug')='enable');
+    if DebugMode then begin
+      DebugForm.show;
+      tempMenu := TMenuItem.Create(FileMenu);
+      tempMenu.Caption := '&Show Debug Log';
+      tempMenu.OnClick := ShowDebugClick;
+      FileMenu.Add(tempMenu);
+    end;  
     {$IFDEF USE_SKINS} 
+    DebugForm.Memo.Lines.Add('Adding Menus');
     tempMenu := TMenuItem.Create(MainMenu);
     tempMenu.Caption := '&Appearance';
@@ -299,4 +311,5 @@
     {$ENDIF}
 
+    DebugForm.Memo.Lines.Add('Showing Splash');
     SplashForm.show;
   
@@ -313,4 +326,5 @@
     CachedWPField := TStringList.Create;  
   
+    DebugForm.Memo.Lines.Add('Adding Grid Info');
     AddGridInfo(BasicUsersGrid,CurrentUserData,true,LoadUserData,'200',btnUsersApply,btnUsersRevert);
     AddGridInfo(AdvancedUsersGrid,CurrentUserData,false,LoadUserData,'200',btnUsersApply,btnUsersRevert);    
@@ -322,8 +336,11 @@
 
     MainForm.Visible := false;
+    DebugForm.Memo.Lines.Add('Trying to connect to server');
     if not ORNet.ConnectToServer(RPC_CONTEXT) then begin
+      DebugForm.Memo.Lines.Add('Failed connection.  Closing.');
       Close; 
       Exit;
     end;
+    DebugForm.Memo.Lines.Add('Connected to server!');
     Application.ProcessMessages;
     LastSelTreeNode := nil;  
@@ -332,4 +349,5 @@
     BasicTemplate.Sorted := false;
     
+    DebugForm.Memo.Lines.Add('Initializing Combo Boxes');
     InitORCombobox(PatientORComboBox,'A');
     InitORCombobox(FileORComboBox,'A');
@@ -347,12 +365,30 @@
     {$IFDEF USE_SKINS} 
     if SkinForm.cbSkinAtStartup.Checked then begin
+      DebugForm.Memo.Lines.Add('Activating Skins');
       SkinForm.ActivateCurrentSkin;    
     end;
     {$ENDIF}
     
-    self.Visible := true;
+    self.Visible := true;    
     SplashForm.Hide;  
-  end;
-
+    DebugForm.Memo.Lines.Add('Done Initializing.');    
+  end;
+
+  function TMainForm.FindParam(Param : string) : string;
+  //Searches command line parameters for Param.  If found, then value returned.
+  //Case insensitive
+  //Must be in 'param=value' format, i.e. must have '='
+  var  i : integer;
+       tempS : string;    
+  begin
+    Result := '';
+    Param := LowerCase(Param);
+    for i := 1 to ParamCount do begin
+      tempS := LowerCase (ParamStr(i));
+      if Pos(Param,tempS)>0 then Result := Piece(tempS,'=',2);
+    end;
+  end;  
+
+  
   procedure TMainForm.AddGridInfo(Grid: TStringGrid; 
                                   Data : TStringList; 
@@ -1536,5 +1572,5 @@
   end;
 
-  procedure TMainForm.Exit1Click(Sender: TObject);
+  procedure TMainForm.ExitMenuItemClick(Sender: TObject);
   begin
        Close;
@@ -1970,4 +2006,9 @@
   end;
 
+  procedure TMainForm.ShowDebugClick(Sender: TObject);
+  begin
+    DebugForm.Show;
+  end;
+  
   procedure TMainForm.ChangeSkinClick(Sender: TObject);
   var result : TModalResult;
