I wouldn't recommend trying to manipulate the SharePoint InfoPath viewer, I would insert any code needed directly into the InfoPath form template before publishing to SharePoint. From there you can setup your pre-populate conditions among other things. Beware however, web enabled InfoPath forms cannot do everything that regular InfoPath forms can do. It all depends on what exactly you are trying to accomplish.
It could be done also in workflow initiation form, but be carufull. By modifications to IniWrkflIP.aspx page you make changes globally. If you need to get the ID of the current item, your hit on this page makes sense, so what do you give and what does not make sense is on your consideration...
Get context data at the Workflow Start form