making p_debug.js work with apikey as an argument. definitely not clean code, just a first swipe at seeing if it could work.