{
// if we are plotting something and 
// the mouse is in the plotting area
// and the left mouse button is clicked.

	if (
		(IsPlotOrder          ||
		 IsPlotTime)          &&
		 PtInRect(&D, mouse)
	   ) 
	{
	static SIZE sz ;
	static char  date[80] ;
	static char order[80] ;
	static char  alig[80] ;
	static char  avel[80] ;
	static char rlamb[80] ;
	static char mlamb[80] ;
	static LPFOURIER f ; 
	double alOrder, alDays, alFrq, alPhase ;
	double rlOrder, rlDays, rlFrq, rlPhase ;
    double mlOrder, mlDays, mlFrq, mlPhase ;
    static u, x ;
	   int Alstate, RLstate, MLstate ;
	static set1 = 0, set2 = 0, set3 = 0, set4 = 0, set5 = 0 ;
	static RECT rc1, rc2, rc3, rc4, rc5 ;

    if (IsPlotTime)
	   {
				    Alstate = RLstate = MLstate = 0 ;

					  PickDate(mouse.x, date) ;

					// Send WM_PAINT to the ArchiveWork window
					// but do NOT invalidate the window first.

					  if (wantDateClick) UpdateWindow(hWndArch) ;
					  
					// It will update to the date clicked and
					// then tell the viewer to display the result,
					// without changing the chart display.

					// TO DO:  same thing in response to key presses.
	   }

	if (IsPlotOrder)
	   {
				    Alstate = RLstate = MLstate = 0 ;

		 // convert mouse X-position to corresponding order
		  curOrder = (double)(mouse.x - xlmar) * fspan / (double)wd + lo_f ;
		 // convert this order to the corresponding number of days
		   curDays = align->period / curOrder ;
		 // convert this to a frequency in cycles per day
		   curFrq = 1.0 / curDays ;

		   if (PlotAlAmp) // plotting alignment spectrum
		   {
				    f = pAlFou ;
			   // is mouse in one of the enclosing rectangles?
			   for (x = 0 ; x < f->Peaks ; x++)
			   {
				   if (PtInRect(&(f->rcPeak[x]), mouse))
				   {
					   Alstate = 1 ;
					   alOrder = f->ordPeak[x] ;
					    alDays = align->period / alOrder ;
					     alFrq = 1.0 / alDays ;
					   alPhase = f->phaPeak[x] ; 
				   }
			   }
		   }

		   if (AmpliSpectrum) // plotting raw lambda spectrum
		   {
				    f = pSamp ;
			   // is mouse in one of the enclosing rectangles?
			   for (x = 0 ; x < f->Peaks ; x++)
			   {
				   if (PtInRect(&(f->rcPeak[x]), mouse))
				   {
					   RLstate = 1 ;
					   rlOrder = f->ordPeak[x] ;
					    rlDays = align->period / rlOrder ;
					     rlFrq = 1.0 / rlDays ;
					   rlPhase = f->phaPeak[x] ; 
				   }
			   }
		   }

		   if (mAmpliSpectrum) // plotting running mean lambda spectrum
		   {
				    f = pSamp ;
			   // is mouse in one of the enclosing rectangles?
			   for (x = 0 ; x < f->mPeaks ; x++)
			   {
				   if (PtInRect(&(f->rcmPeak[x]), mouse))
				   {
					   MLstate = 1 ;
					   mlOrder = f->mordPeak[x] ;
					    mlDays = align->period / mlOrder ;
					     mlFrq = 1.0 / mlDays ;
					   mlPhase = f->mphaPeak[x] ; 
				   }
			   }
		   }
	   }

	       hDC = GetDC(hWnd) ;
		  oFnt = SelectObject(hDC, hfnt1) ;
		  SetBkMode(hDC, OPAQUE) ;
		  SetBkColor(hDC, RGB(255, 255, 255)) ;
		  SetTextColor(hDC, RGB(0, 0, 0)) ;

		  if (IsPlotTime)
		  {
			  int len ;
			  if (set1)	// not for first pass, there's not been a string shown
			  {
				  vrc(hWnd, NULL) ;         // preserve general window contents
				  ivrc(hWnd, &rc1, TRUE) ;			 // but wipe most recent string
				  UpdateWindow(hWnd) ;				 // now
			  }

			  GetTextExtentPoint32(hDC, date, len = strlen(date), &sz) ;

		      TextOut(hDC, 40, 1, date, len) ; // show current string

			  // record current string size for future wiping
			  SetRect(&rc1, 40, 1, 45 + sz.cx, 1 + sz.cy) ;
			  if (!set1) set1 = 1 ; // this was the first pass
		  }

		  if (IsPlotOrder)
		  {
			  int len ;
			  sprintf(order,
				  "Order at Cursor: %6.3f, period: %6.3f days, frequency: %6.3f cycles/day",
				                       curOrder, curDays, curFrq) ;

			  GetTextExtentPoint32(hDC, order, len = strlen(order), &sz) ;

			  if (set1)
			  {
				  vrc(hWnd, NULL) ;
				  ivrc(hWnd, &rc1, TRUE) ;
				  UpdateWindow(hWnd) ;
			  }
		      TextOut(hDC,  40, 1, order, len) ;
			  SetRect(&rc1, 40, 1, 45 + sz.cx, 1 + sz.cy) ;
			  if (!set1) set1 = 1 ;
		  }

		  if (Alstate)
		  {
			  int len ;
			  sprintf(alig,
				  "ALIGNMENT, Order of Peak %6.4f, Period %6.4f days, Freq %6.4f cycles/day, Phase %6.2f degrees",
				              alOrder, alDays, alFrq, alPhase * r2d) ;
			  GetTextExtentPoint32(hDC, alig, len = strlen(alig), &sz) ;
			  if (set2)
			  {
				  vrc(hWnd, NULL) ;
				  ivrc(hWnd, &rc2, TRUE) ;
			      UpdateWindow(hWnd) ;
			  }
			  TextOut(hDC,  40, 1 + sz.cy, alig, len) ;
			  SetRect(&rc2, 40, 1 + sz.cy, 45 + sz.cx, 1 + 2 * sz.cy) ;
			  if (!set2) set2 = 1 ;
		  }

		  if (RLstate)
		  {
			  int len ;
			  sprintf(rlamb,
				  "RAW LAMBDA, Order of Peak %6.4f, Period %6.4f days, Freq %6.4f cycles/day, Phase %6.2f degrees",
				              rlOrder, rlDays, rlFrq, rlPhase * r2d) ;
			  GetTextExtentPoint32(hDC, rlamb, len = strlen(rlamb), &sz) ;
			  if (set4)
			  {
				  vrc(hWnd, NULL) ;
				  ivrc(hWnd, &rc4, TRUE) ;
			      UpdateWindow(hWnd) ;
			  }
			  TextOut(hDC,  40, 1 + 3 * sz.cy, rlamb, len) ;
			  SetRect(&rc4, 40, 1 + 3 * sz.cy, 45 + sz.cx, 1 + 4 * sz.cy) ;
			  if (!set4) set4 = 1 ;
		  }

		  if (MLstate)
		  {
			  int len ;
			  sprintf(mlamb,
				  "MEAN LAMBDA, Order of Peak %6.4f, Period %6.4f days, Freq %6.4f cycles/day, Phase %6.2f degrees",
				              mlOrder, mlDays, mlFrq, mlPhase * r2d) ;

			  GetTextExtentPoint32(hDC, mlamb, len = strlen(mlamb), &sz) ;

			  if (set5)
			  {
			    vrc(hWnd, NULL) ;
			   ivrc(hWnd, &rc5, TRUE) ;
			   UpdateWindow(hWnd) ;
			  }
		      TextOut(hDC,  40, 1 + 4 * sz.cy, mlamb, len) ;
			  SetRect(&rc5, 40, 1 + 4 * sz.cy, 45 + sz.cx, 1 + 5 * sz.cy) ;
			  if (!set5) set5 = 1 ;
		  }
		  SelectObject(hDC, oFnt) ;
		  ReleaseDC(hWnd, hDC) ;
	}
}