Code to include a js file in another js file.
var js1 = document.createElement('script');
js1.type = 'text/javascript';
js1.src = 'js1.js';
var headEl = document.getElementsByTagName('head')[0];
headEl.appendChild(js1);
var js1 = document.createElement('script');
js1.type = 'text/javascript';
js1.src = 'js1.js';
var headEl = document.getElementsByTagName('head')[0];
headEl.appendChild(js1);