Hi Dimitirs,
When you navigate to the right page, I guess you can find the text location where the graphic with the text frame should be inserted? That text location must be used to set the TextSelection property of the document. Methods like Doc.AddText and Doc.Paste always use the current TextSelection.
Assuming you have the target location stored in a variable oTLoc, this is what you need to do:
var oTRange = new TextRage ( oTLoc, oTLoc ); /* using the same 'beg' and 'end' object effectively moves the cursor to the text location */
oDoc.TextSelection = oTRange;
oDoc.Paste( 0 ); /* the parameter is a field of flags to determine what to do, in your case 0 seems to be appropriate */
FYI, In my scripting I always prefix variable names with an indicator of the variable type (as javascript has no explicit typing), so any object receives a lower-case o, strings have 's', string arrays 'sa' etc. When writing elaborate scripts, this does sometimes help to avoid and/or find bugs due to incorrect types being used when passing parameters to methods.
Good luck. Let us know when this solved your problem.
Jang