XPage in 8.5.1 client - How do I create a new Notes document

I have an XPage displaying a table in the Notes client using JavaScript & HTML. Great.

What I want is for the ‘onClick’ event of some s to do the equivalent of :-

Dim session As New NotesSession

Dim workspace As New NotesUIWorkspace

Dim db As NotesDatabase

Dim maildoc As NotesDocument

Dim strSubject As String, strName As String

Dim startDateTime As String, endDateTime As String



    Set maildoc = New NotesDocument(db)



Call maildoc.replaceItemValue("Form", "Appointment")

Call maildoc.replaceItemValue("Subject", "The Subject")

.

.

.

.

call maildoc.computeWithForm(false, false)



Call workspace.Editdocument(True, maildoc)

That is, I want to compose a ‘traditional’ Notes document in the client from a click on an xpage and not create it as a web page or xpage.

Is it possible to do this with client-side JS in the Notes client?