You're currently using the onload handler wrong. It need to have only a reference to the handlers - here the result of those functions are returned to it instead.
Simply change these lines:
router_pic.onload = item_loaded; //no parenthesis
switch_pic.onload = item_loaded;
I would also recommend switching the onload line with src line so src comes last.
Hope this helps!