fixed insertAtCaret function again to support Opera