private void FocusElement(IHTMLElement2 element, bool selectAll)
 {
     if (element != null)
     {
         try
         {
             element.focus();
         }
         catch (Exception e)
         {
             //This can cause an exception under some weblog styles when some behaviors are attached.  Bug 407544.
             Trace.Fail("Unexpected exception while focusing element", e.ToString());
         }
         if (selectAll)
             SelectAll();
     }
 }