There are two options. You can use NPN_Evaluate or you can get a reference to the window
object with NPN_GetValue:
NPObject* window;
NPError err = NPN_GetValue(pNPP, NPNVWindowNPObject, &window);
Once you have the window NPObject then you can invoke global javascript functions with NPN_Invoke and get/set properties with NPN_GetProperty and NPN_SetProperty.
You might consider using FireBreath, which hugely simplifies all of this.