use shared base template. added js error logging to it.#632